.agent-model-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: calc(100% - 48px);
  min-height: 36px;
  padding: 7px 12px;
  margin-right: 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #292929;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 120ms ease;
}
.agent-model-selection { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-effort-label] { color: #686868; }
.agent-model-trigger svg, .agent-model-heading svg, .agent-model-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; flex-shrink: 0; }
.agent-model-trigger:hover, .agent-model-trigger[aria-expanded="true"] { background: rgba(0,0,0,.07); }
.agent-model-trigger:disabled { cursor: wait; opacity: .6; }
.agent-model-trigger:focus-visible, .agent-model-menu button:focus-visible { outline: 2px solid #397df0; outline-offset: 2px; }
body.dark-theme .agent-model-trigger { color: #f1f1f1; }
body.dark-theme [data-effort-label] { color: #aaa; }
body.dark-theme .agent-model-trigger:hover, body.dark-theme .agent-model-trigger[aria-expanded="true"] { background: rgba(255,255,255,.08); }

.agent-model-menu {
  --picker-text: #292929;
  --picker-muted: #666;
  --picker-line: #ddd;
  --picker-hover: #eee;
  --effort-accent: #2468ce;
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 10px;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  box-sizing: border-box;
  border: 1px solid var(--picker-line);
  border-radius: 22px;
  background: #fafafa;
  color: var(--picker-text);
  box-shadow: 0 12px 32px rgba(0,0,0,.15);
  overflow: hidden;
  font-family: inherit;
}
.agent-model-menu:popover-open { display: flex; flex-direction: column; }
.agent-model-menu [hidden] { display: none !important; }
body.dark-theme .agent-model-menu {
  --picker-text: #f1f1f1;
  --picker-muted: #aaa;
  --picker-line: #3e3e3e;
  --picker-hover: #373737;
  --effort-accent: #5598ff;
  background: #2b2b2b;
  box-shadow: 0 12px 32px rgba(0,0,0,.3);
  color-scheme: dark;
}
.agent-model-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
}
.agent-model-header > svg { width: 20px; height: 20px; fill: none; stroke: var(--picker-muted); stroke-width: 1.6; flex-shrink: 0; }
.agent-model-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 54px;
  padding: 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.agent-effort-title { display: flex; align-items: center; gap: 3px; }
.agent-model-menu .agent-model-heading [data-effort-label] { color: var(--effort-accent); font-size: 18px; }
.agent-model-heading [data-model-label] { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--picker-muted); font-size: 14px; font-weight: 400; }
.agent-model-heading svg { color: var(--picker-muted); }
.agent-model-heading:hover:not(:disabled) { background: var(--picker-hover); }
.agent-model-heading:disabled { cursor: default; }
.agent-effort-reset { display: grid; place-items: center; width: 28px; height: 32px; padding: 3px; border: 0; border-radius: 8px; background: transparent; color: var(--picker-muted); cursor: pointer; flex-shrink: 0; }
.agent-effort-reset svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.agent-effort-reset:hover:not(:disabled) { background: var(--picker-hover); }
.agent-effort-reset:disabled { opacity: .4; cursor: default; }
.agent-effort-track { --effort-progress: 0; position: relative; height: 36px; margin: 12px 6px 8px; border-radius: 999px; background: #d3d3d3; }
body.dark-theme .agent-effort-track { background: #464646; }
.agent-effort-fill { position: absolute; inset: 0 auto 0 0; width: calc(18px + (100% - 36px) * var(--effort-progress)); border-radius: inherit; overflow: hidden; pointer-events: none; background: #397df0; }
#agentEffortRange { position: relative; z-index: 2; appearance: none; -webkit-appearance: none; width: 100%; height: 36px; margin: 0; border-radius: 999px; background: transparent; cursor: pointer; }
#agentEffortRange::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.16); }
#agentEffortRange::-moz-range-thumb { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.16); }
#agentEffortRange:focus-visible { outline: 2px solid var(--effort-accent); outline-offset: 4px; }
#agentEffortRange:disabled { opacity: .6; cursor: default; }
.agent-effort-track.is-disabled .agent-effort-fill { background: #929292; }
.agent-effort-ticks { position: absolute; inset: 0 18px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.agent-effort-ticks span { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.42); }
.agent-model-menu.is-ultra { --effort-accent: #8140cc; }
body.dark-theme .agent-model-menu.is-ultra { --effort-accent: #b383ff; }
.is-ultra .agent-effort-fill { width: 100%; background: linear-gradient(105deg, #334ccf 0%, #9159eb 42%, #b57df6 65%, #7752da 100%); }
.agent-effort-stars { display: none; position: absolute; inset: 0; pointer-events: none; }
.is-ultra .agent-effort-stars { display: block; }
.is-ultra .agent-effort-ticks { visibility: hidden; }
.agent-effort-stars span { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #f8eaff; opacity: .65; box-shadow: 0 0 3px #ead8ff; }
.agent-effort-stars span:nth-child(3n) { width: 2px; height: 2px; }
.agent-model-menu:popover-open.is-ultra .agent-effort-stars span { animation: agent-star-drift var(--drift) ease-in-out var(--delay) infinite alternate; }
@keyframes agent-star-drift { from { transform: translate(-8px, 4px) scale(.7); opacity: .2; } to { transform: translate(12px, -4px) scale(1.15); opacity: .9; } }
/* Gemini — 노력 슬라이더 대신 '확장된 사고 모델' 스위치 하나(09-24) */
.agent-think-toggle { display: flex; align-items: center; gap: 12px; margin: 10px 0 2px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.agent-think-toggle:hover { background: var(--picker-hover); }
.agent-think-toggle:has(:disabled) { cursor: default; color: var(--picker-muted); }
.agent-think-toggle:has(:disabled):hover { background: transparent; }
#agentThinkInput { appearance: none; -webkit-appearance: none; position: relative; flex-shrink: 0; width: 40px; height: 24px; margin: 0; border-radius: 999px; background: #c4c4c4; cursor: inherit; transition: background 120ms ease; }
body.dark-theme #agentThinkInput { background: #555; }
#agentThinkInput::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform 120ms ease; }
#agentThinkInput:checked, body.dark-theme #agentThinkInput:checked { background: #397df0; }
#agentThinkInput:checked::after { transform: translateX(16px); }
#agentThinkInput:disabled { opacity: .5; }
#agentThinkInput:focus-visible { outline: 2px solid var(--effort-accent); outline-offset: 2px; }
.agent-model-list { display: flex; flex-direction: column; min-height: 0; }
.agent-model-back { display: flex; align-items: center; gap: 7px; padding: 6px 10px 10px; border: 0; background: transparent; color: var(--picker-muted); font: inherit; font-size: 13px; text-align: left; cursor: pointer; flex-shrink: 0; }
.agent-model-options { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.agent-model-title { padding: 6px 10px 10px; color: var(--picker-muted); font-size: 13px; flex-shrink: 0; }
.agent-model-option { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.agent-model-option:hover:not(:disabled) { background: var(--picker-hover); }
.agent-model-option:focus-visible { outline-offset: -2px; }
.agent-model-copy { flex: 1; min-width: 0; }
.agent-model-name { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 15px; font-weight: 500; line-height: 1.5; }
.agent-model-description { display: block; color: var(--picker-muted); font-size: 12px; line-height: 1.5; }
.agent-model-option:disabled { cursor: not-allowed; color: var(--picker-muted); }
.agent-model-badge { padding: 1px 5px; border: 1px solid var(--picker-line); border-radius: 5px; font-size: 10px; font-weight: 400; }
.agent-model-check { width: 19px; height: 19px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }
.agent-model-chevron { width: 16px; height: 16px; stroke: var(--picker-muted); stroke-width: 1.8; fill: none; flex-shrink: 0; }
.agent-model-retry { align-self: center; margin: 4px 0; padding: 7px 14px; border: 1px solid var(--picker-line); border-radius: 8px; color: inherit; background: var(--picker-hover); cursor: pointer; }
.agent-model-error { margin: 4px 12px 10px; color: var(--picker-muted); font-size: 13px; line-height: 1.5; text-align: center; }
.agent-picker-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 480px) {
  .agent-model-trigger { min-height: 40px; padding-inline: 6px; font-size: 13px; }
  .agent-model-trigger .agent-model-selection { display: flex; flex-wrap: wrap; column-gap: 4px; white-space: normal; text-align: left; }
  .agent-model-trigger [data-model-label] { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .agent-model-trigger [data-effort-label] { white-space: nowrap; }
  .agent-model-option { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .agent-model-trigger, #agentThinkInput, #agentThinkInput::after { transition: none; }
  .agent-model-menu:popover-open.is-ultra .agent-effort-stars span { animation: none; }
}

/* 구독 CLI 연결 모달 (2026-09-23)
   ⚠️ --picker-* 는 .agent-model-menu 안에서만 정의된다. 팝오버 밖에서는 못 쓰므로
   여기서는 트리거와 같은 방식(고정색 + body.dark-theme 재정의)으로 칠한다. */
.cli-connect-backdrop { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: rgb(0 0 0 / 45%); }
.cli-connect-box { width: min(420px, calc(100vw - 32px)); border-radius: 14px; background: #fff; color: #292929; box-shadow: 0 18px 48px rgb(0 0 0 / 28%); }
.cli-connect-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #ddd; }
.cli-connect-close { border: 0; background: transparent; color: inherit; font-size: 14px; cursor: pointer; }
.cli-connect-body { display: flex; flex-direction: column; gap: 10px; padding: 16px; font-size: 13px; line-height: 1.6; }
.cli-connect-body p { margin: 0; }
.cli-connect-muted { color: #686868; }
.cli-connect-primary { min-height: 38px; padding: 8px 14px; border: 1px solid #ddd; border-radius: 9px; background: rgba(0,0,0,.05); color: inherit; font: inherit; cursor: pointer; }
.cli-connect-primary:hover:not(:disabled) { background: rgba(0,0,0,.09); }
.cli-connect-primary:disabled { opacity: .6; cursor: default; }
.cli-connect-input { min-height: 38px; padding: 8px 10px; border: 1px solid #ddd; border-radius: 9px; background: transparent; color: inherit; font: inherit; }
.cli-connect-list { display: flex; flex-direction: column; gap: 2px; }
.cli-connect-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 4px 0; border-top: 1px solid #eee; }
.cli-connect-row:first-child { border-top: 0; }
.cli-connect-name { min-width: 0; font-size: 13px; }
.cli-connect-account { display: block; margin-top: 2px; font-size: 12px; color: #686868; overflow-wrap: anywhere; }
.cli-connect-ok { flex: none; font-size: 12px; color: #1a7f4b; }
.cli-connect-small { min-height: 30px; padding: 4px 12px; font-size: 12px; }
body.dark-theme .cli-connect-row { border-top-color: #333; }
body.dark-theme .cli-connect-ok { color: #4ec98a; }
body.dark-theme .cli-connect-box { background: #1f1f1f; color: #f1f1f1; }
body.dark-theme .cli-connect-head { border-bottom-color: #3a3a3a; }
body.dark-theme .cli-connect-muted, body.dark-theme .cli-connect-account { color: #aaa; }
body.dark-theme .cli-connect-primary { border-color: #3a3a3a; background: rgba(255,255,255,.1); }
body.dark-theme .cli-connect-primary:hover:not(:disabled) { background: rgba(255,255,255,.16); }
body.dark-theme .cli-connect-input { border-color: #3a3a3a; }

/* 입력창 옆 상시 모드 선택 — 크레딧(API) / 구독 계정 (2026-09-23) */
.agent-mode-switch { display: inline-flex; gap: 2px; margin-right: 6px; padding: 2px; border: 1px solid rgba(0,0,0,.12); border-radius: 9px; }
.agent-mode-switch button { min-height: 26px; padding: 3px 9px; border: 0; border-radius: 7px; background: transparent; color: #686868; font: inherit; font-size: 12px; line-height: 1.3; white-space: nowrap; cursor: pointer; }
.agent-mode-switch button[aria-selected="true"] { background: rgba(0,0,0,.08); color: #292929; font-weight: 500; }
.agent-mode-switch button:hover:not([aria-selected="true"]) { color: #292929; }
body.dark-theme .agent-mode-switch { border-color: rgba(255,255,255,.16); }
body.dark-theme .agent-mode-switch button { color: #aaa; }
body.dark-theme .agent-mode-switch button[aria-selected="true"] { background: rgba(255,255,255,.14); color: #f1f1f1; }
body.dark-theme .agent-mode-switch button:hover:not([aria-selected="true"]) { color: #f1f1f1; }
@media (max-width: 560px) { .agent-mode-switch button { padding: 3px 7px; font-size: 11px; } }

/* 입력창 사용량 게이지 (2026-09-23) — 모델 선택 옆. 12시 방향에서 시계방향으로 찬다. */
.agent-usage-ring { display: inline-flex; flex: none; width: 18px; height: 18px; margin-right: 8px; color: #686868; }
.agent-usage-ring[hidden] { display: none; }
.agent-usage-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.agent-usage-ring circle { fill: none; stroke: currentColor; stroke-width: 2.2; }
.agent-usage-ring .track { opacity: .25; }
.agent-usage-ring .fill { transition: stroke-dashoffset .4s ease; }
.agent-usage-ring.is-high { color: #d93f3f; }
body.dark-theme .agent-usage-ring { color: #aaa; }
body.dark-theme .agent-usage-ring.is-high { color: #ff6b6b; }
@media (prefers-reduced-motion: reduce) { .agent-usage-ring .fill { transition: none; } }
.agent-usage-ring { cursor: default; border-radius: 50%; }
.agent-usage-ring:focus-visible { outline: 2px solid #397df0; outline-offset: 2px; }

/* 게이지에 올리면 뜨는 카드 — 입력창 카드가 overflow:hidden 이라 body 에 붙여 fixed 로 띄운다. */
.agent-usage-pop { position: fixed; z-index: 1000; width: 248px; padding: 12px 14px 10px; border: 1px solid #e2e2e2; border-radius: 12px; background: #fff; color: #292929; box-shadow: 0 8px 24px rgba(0,0,0,.12); font-size: 13px; line-height: 1.35; pointer-events: none; }
.agent-usage-pop[hidden] { display: none; }
.agent-usage-pop-title { margin-bottom: 10px; font-size: 12px; font-weight: 600; color: #686868; }
.agent-usage-pop-account { margin: -7px 0 10px; font-size: 12px; color: #686868; overflow-wrap: anywhere; }
.agent-usage-pop-row + .agent-usage-pop-row { margin-top: 12px; }
.agent-usage-pop-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.agent-usage-pop-head strong { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.agent-usage-pop-bar { height: 6px; border-radius: 999px; background: rgba(0,0,0,.08); overflow: hidden; }
.agent-usage-pop-bar span { display: block; height: 100%; border-radius: inherit; background: #555; }
.agent-usage-pop-sub { margin-top: 5px; font-size: 12px; color: #686868; }
.agent-usage-pop-row.is-high .agent-usage-pop-head strong { color: #d93f3f; }
.agent-usage-pop-row.is-high .agent-usage-pop-bar span { background: #d93f3f; }
body.dark-theme .agent-usage-pop { border-color: #333; background: #1f1f1f; color: #f1f1f1; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
body.dark-theme .agent-usage-pop-title, body.dark-theme .agent-usage-pop-sub, body.dark-theme .agent-usage-pop-account { color: #9a9a9a; }
body.dark-theme .agent-usage-pop-bar { background: rgba(255,255,255,.1); }
body.dark-theme .agent-usage-pop-bar span { background: #d6d6d6; }
body.dark-theme .agent-usage-pop-row.is-high .agent-usage-pop-head strong { color: #ff6b6b; }
body.dark-theme .agent-usage-pop-row.is-high .agent-usage-pop-bar span { background: #ff6b6b; }
