/* Agent settings: neutral gray segmented controls; the one on/off option uses the blue search switch. */
.agent-settings { display: grid; gap: 48px; }
.agent-setting { display: grid; gap: 20px; }
.agent-state { display: grid; justify-items: start; gap: 16px; color: var(--muted); font-size: 16px; }

/* same as section headings on the subscription tab */
.agent-setting h2 { color: #fff; font-size: 22px; font-weight: 600; letter-spacing: -.025em; }

.segmented { display: grid; grid-template-columns: repeat(var(--segments), minmax(0, 1fr)); width: min(100%, calc(var(--segments) * 210px)); padding: 4px; border-radius: 999px; background: var(--surface-card); }
.segment { position: relative; display: grid; place-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; color: var(--muted); font-size: 16px; font-weight: 600; text-align: center; cursor: pointer; transition: background .15s, color .15s; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment:hover { color: #ddd; }
.segment:has(input:checked) { background: var(--fill-control); color: #fff; }
.segment:has(input:focus-visible) { outline: 2px solid #fff; outline-offset: -2px; }

/* boolean letter option: "tg: @" is written in the field, so the field is the line the letter ends with */
.letter-telegram { padding: 14px 20px 14px 24px; border-radius: 24px; background: var(--surface-card); }
.letter-telegram-form { display: grid; gap: 8px; }
.letter-telegram-row { display: flex; align-items: center; gap: 14px; }
.letter-telegram-label { flex: none; color: #f1f1f1; font-size: 17px; }
.letter-telegram-handle { display: flex; flex: 1; align-items: center; min-width: 0; height: 42px; padding: 0 14px; border: 1px solid transparent; border-radius: 12px; background: #2a2a2a; color: #8a8a8a; font-size: 16px; cursor: text; transition: background .15s, border-color .15s, opacity .15s; }
.letter-telegram-handle > span { flex: none; white-space: pre; }
.letter-telegram-handle input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; color: #f1f1f1; font: inherit; outline: none; }
.letter-telegram-handle input::placeholder { color: #666; }
.letter-telegram-handle input:disabled { color: var(--muted); }
.letter-telegram-handle:hover { background: #303030; }
.letter-telegram-handle:focus-within { background: #303030; border-color: #4a4a4a; }

/* off: the field stays editable, it only fades so the switch reads first */
.letter-telegram-row:has([aria-checked="false"]) .letter-telegram-handle:not(:focus-within) { opacity: .5; }

/* the note shows only why the switch was refused or why the field is locked */
.letter-telegram-note { margin: 0; padding-left: 4px; color: #ff6961; font-size: 13px; line-height: 1.3; }
.letter-telegram-note.is-info { color: var(--muted); }
.letter-telegram-note:empty { display: none; }

/* refused switch: a short shake and a red field */
.letter-telegram-form.is-invalid .letter-telegram-handle { border-color: #ff453a; }
.search-toggle.is-refused { animation: letter-telegram-refuse .4s; }
.search-toggle.is-refused .toggle-thumb { animation: letter-telegram-nudge .4s; }
@keyframes letter-telegram-refuse { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes letter-telegram-nudge { 30% { transform: translateX(8px); } }

/* the same rows on every level: only the answerer changes, so a level switch reads at a glance */
.autonomy-card { padding: 18px 24px 6px; border-radius: 28px; background: var(--surface-card); }
.autonomy-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 12px; color: #777; font-size: 13px; font-weight: 600; }
.autonomy-list { margin: 0; padding: 0; list-style: none; }
.autonomy-list li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.autonomy-question { display: grid; gap: 3px; color: #f1f1f1; font-size: 17px; line-height: 1.3; }
.autonomy-question small { color: var(--muted); font-size: 14px; }
.answerer { flex: none; color: #8a8a8a; font-size: 15px; font-weight: 600; }
.is-agent .answerer { color: #fff; }

@media (max-width: 600px) {
  .agent-settings { gap: 40px; }
  .segment { min-height: 42px; padding: 0 8px; font-size: 14px; }
  .letter-telegram { padding: 14px 16px 14px 18px; }
  .letter-telegram-row { flex-wrap: wrap; row-gap: 10px; }
  .letter-telegram-label { font-size: 16px; }
  .letter-telegram-handle { order: 1; flex-basis: 100%; }
  .letter-telegram-row .search-toggle { margin-left: auto; }
  .autonomy-card { padding: 16px 18px 4px; border-radius: 24px; }
  .autonomy-question { font-size: 16px; }
  .autonomy-question small { font-size: 13px; }
}
