/* Agents & terminals: Görevler, session conversation, launcher, Terminaller, xterm pages.
   Same language as app.css — hairlines, one accent, tabular numbers, calm. Only tokens from
   :root are used, so light/dark follow the panel theme. No inline styles anywhere (CSP). */

.ag-probe { position: absolute; top: 0; left: 0; width: 0; visibility: hidden; pointer-events: none; }

/* ---- Shared bits ----------------------------------------------------------------------- */

.ag-mark {
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
}
.ag-mark-sm { width: 24px; height: 24px; border-radius: 7px; }
.ag-mark-claude { color: var(--text); }

.ag-pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 20px; padding: 0 8px 0 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 11.5px; font-weight: 500; line-height: 1; white-space: nowrap;
}
.ag-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.ag-pill.tone-accent { background: var(--accent-soft); color: var(--accent-text); }
.ag-pill.tone-warning { background: var(--warn-soft); color: var(--warn); }
.ag-pill.tone-faint { background: transparent; box-shadow: inset 0 0 0 1px var(--border); color: var(--text-3); }
.ag-pill-dot.is-live { animation: ag-live 1.8s var(--ease) infinite; }
@keyframes ag-live {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
  70% { box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 0%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---- Görevler (list) ---------------------------------------------------------------------- */

.ag-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ag-search { position: relative; display: flex; align-items: center; flex: 1 1 260px; min-width: 0; }
.ag-search > .icon { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.ag-search-input { padding-left: 34px; }
.ag-search-input::-webkit-search-cancel-button { cursor: pointer; }
.ag-toolbar .segmented { margin: 0; }
.ag-seg .seg { align-items: center; }
.ag-seg .seg-count { font-variant-numeric: tabular-nums; }
.ag-selects { display: flex; gap: 8px; flex: none; }
.ag-selects .input-sm { height: 34px; max-width: 200px; }

.ag-lists > * + * { margin-top: 24px; }
.ag-group-title { margin: 0 0 8px 2px; color: var(--text-3); font-size: 12.5px; font-weight: 500; letter-spacing: 0.01em; }

.ag-list { overflow: hidden; }
.ag-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: start; gap: 4px 12px;
  padding: 12px 16px; color: inherit; text-decoration: none;
  transition: background-color 120ms var(--ease);
}
.ag-row + .ag-row { border-top: 1px solid var(--border); }
.ag-row:hover { background: var(--surface-2); }
.ag-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }
.ag-row > .ag-mark { margin-top: 1px; }
.ag-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ag-row-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ag-row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--text); }
.ag-row-title.faint { color: var(--text-3); }
.ag-row-meta { display: flex; flex-wrap: wrap; align-items: baseline; min-width: 0; color: var(--text-3); font-size: 12.5px; }
.ag-row-meta > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-row-meta > span + span::before { content: "·"; margin: 0 7px; color: var(--text-4); }
.ag-row-conflict { display: flex; align-items: flex-start; gap: 6px; margin-top: 3px; color: var(--warn); font-size: 12.5px; }
.ag-row-conflict > .icon { margin-top: 2px; }
.ag-row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; color: var(--text-3); font-size: 12.5px; white-space: nowrap; text-align: right; padding-top: 1px; }
.ag-row-live { max-width: 16em; overflow: hidden; text-overflow: ellipsis; color: var(--text-4); font-size: 11.5px; }
.ag-row.is-ended .ag-row-title { color: var(--text-2); }
.ag-sub { flex: none; color: var(--text-3); font-size: 11.5px; white-space: nowrap; }

.ag-empty { padding: 8px 0 4px; }
.ag-empty-actions { padding: 0 16px 14px; }
.ag-more { display: flex; justify-content: center; }
.ag-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; color: var(--text-3); font-size: 12.5px; }

/* ---- Yeni görev (launcher) ---------------------------------------------------------------- */

.ag-new-form { max-width: 780px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.ag-new-sec { padding: 18px 20px; }
.ag-new-sec + .ag-new-sec { border-top: 1px solid var(--border); }
.ag-new-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ag-new-sec-head h2 { font-size: 13.5px; font-weight: 600; }
.ag-new-sec .field + .field { margin-top: 14px; }
.ag-new-sec > .segmented:not(.ag-kinds) { margin-bottom: 10px; }

.ag-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; background: none; }
.seg.ag-kind {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text-2); text-align: left; white-space: normal;
}
.seg.ag-kind:hover { background: var(--surface-2); color: var(--text); }
.seg.ag-kind[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); color: var(--text); }
.seg.ag-kind[aria-pressed="true"] .ag-mark { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--accent-text); background: var(--surface); }
.ag-kind-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ag-kind-label { color: var(--text); font-size: 14px; font-weight: 600; }
.ag-kind .seg-sub { display: block; color: var(--text-3); font-size: 12px; font-weight: 400; }

.ag-projects { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.ag-proj { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 9px 12px; cursor: pointer; transition: background-color 120ms var(--ease); }
.ag-proj + .ag-proj { border-top: 1px solid var(--border); }
.ag-proj:hover { background: var(--surface-2); }
.ag-proj:has(input:checked) { background: var(--accent-soft); }
.ag-proj > input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.ag-proj-main { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-width: 0; }
.ag-proj-name { font-size: 13.5px; font-weight: 500; color: var(--text); }
.ag-proj-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 12px; }
.ag-proj-badges { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; flex: none; max-width: 50%; }
.ag-branch { display: inline-flex; align-items: center; gap: 4px; max-width: 18em; height: 20px; padding: 0 7px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font: 11.5px/1 var(--mono); white-space: nowrap; overflow: hidden; }
.ag-branch > span { overflow: hidden; text-overflow: ellipsis; }
.ag-nogit { font-size: 12px; }
.ag-proj-custom .input { height: 34px; margin-top: 6px; font-size: 13px; }
.ag-cwd-line { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.ag-cwd-line.is-invalid { color: var(--crit); }
.ag-prompt { min-height: 120px; resize: vertical; font-size: 14.5px; line-height: 1.5; }

.ag-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; margin: 0; font-size: 13.5px; }
.ag-kv-row { display: contents; }
.ag-kv dt { color: var(--text-3); padding-top: 1px; }
.ag-kv dd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; margin: 0; color: var(--text); }
.ag-kv dd > span { overflow-wrap: anywhere; }
.ag-kv-id { margin-left: 8px; font-size: 12px; }
.ag-default-note { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 11.5px; font-weight: 500; }
.ag-opt-select { max-width: 320px; }
.ag-opts-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; }
.ag-opts-foot .hint { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.ag-opts-foot .ag-cmdline { font-family: var(--mono); font-size: 11.5px; }
.ag-new-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.ag-new-actions .form-error { flex: 1 1 100%; }
.ag-start { min-width: 200px; }

/* ---- Session: layout --------------------------------------------------------------------- */

main.ag-main, main[data-view="agent-session"] { padding-bottom: 0; }
.ag-sess {
  max-width: 880px; margin: 0 auto;
  padding-bottom: var(--ag-bottom, 0px);
  overflow-anchor: none;
}
.ag-sess.is-term { max-width: none; }

.ag-head { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.ag-head-row { display: flex; align-items: center; gap: 10px; min-height: 40px; min-width: 0; }
.ag-back { margin-left: -8px; color: var(--text-3); flex: none; }
.ag-back .ag-back-text { font-weight: 500; }
.ag-title-wrap { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 0 1 auto; }
.ag-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; line-height: 1.3; font-weight: 600; letter-spacing: -0.015em; }
.ag-title-input { height: 34px; font-size: 16px; font-weight: 600; min-width: 220px; }
.ag-edit { color: var(--text-3); flex: none; }
.ag-head-pill { display: inline-flex; flex: none; }
.ag-conn { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.ag-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 4px; padding-left: 64px; color: var(--text-3); font-size: 12.5px; }
.ag-meta-item { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; }
.ag-meta-item > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-meta-item .icon { color: var(--text-4); }
.ag-meta-item .mono { font-size: 12px; }

.ag-tabs { display: flex; gap: 2px; margin: 10px 0 -13px 60px; }
.ag-tab {
  height: 34px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--text-3); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: color 120ms var(--ease), border-color 120ms var(--ease);
}
.ag-tab:hover { color: var(--text); }
.ag-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }

.ag-notices:not(:empty) { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.ag-loading { padding-top: 12px; }
.ag-loading > .callout { margin-top: 8px; }
.ag-termpanel { margin-top: 12px; }

.ag-convo { padding: 18px 0 6px; }
.ag-older { display: flex; margin: 0 auto 18px; }
.ag-items { display: flex; flex-direction: column; gap: 10px; }
.ag-item { min-width: 0; }
.ag-convo-end { height: 4px; }

/* ---- Session: items ---------------------------------------------------------------------- */

.ag-k-user { display: flex; flex-direction: column; align-items: flex-end; align-self: flex-end; max-width: min(82%, 640px); margin-top: 16px; }
.ag-items > .ag-k-user:first-child { margin-top: 0; }
.ag-bubble {
  padding: 9px 14px; border-radius: 16px 16px 6px 16px;
  background: var(--surface-2); color: var(--text);
  font-size: 14.5px; line-height: 1.55;
}
.ag-bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ag-bubble.is-long:not(.is-open) .ag-bubble-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 14; line-clamp: 14; overflow: hidden; }
.ag-more-btn { display: block; margin-top: 4px; padding: 2px 0; border: 0; background: none; color: var(--accent-text); font-size: 12.5px; cursor: pointer; }
.ag-user-foot { display: flex; gap: 8px; margin-top: 4px; padding-right: 4px; color: var(--text-4); font-size: 11.5px; }
.ag-time { color: var(--text-4); font-size: 11.5px; white-space: nowrap; }
.ag-k-user.is-pending .ag-bubble { opacity: 0.72; }

.ag-k-assistant { padding: 2px 2px 0; }
.ag-plain { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.65; }
.ag-msg-actions { display: flex; align-items: center; gap: 2px; height: 24px; margin-top: 2px; opacity: 0; transition: opacity 120ms var(--ease); }
.ag-msg-actions .btn { width: 26px; height: 26px; }
.ag-k-assistant:hover .ag-msg-actions, .ag-msg-actions:focus-within { opacity: 1; }
.ag-msg-actions .btn { color: var(--text-3); }

.ag-typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.ag-typing > span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); animation: ag-dot 1.2s ease-in-out infinite; }
.ag-typing > span:nth-child(2) { animation-delay: 0.15s; }
.ag-typing > span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ag-dot { 0%, 80%, 100% { opacity: 0.3; transform: none; } 40% { opacity: 1; transform: translateY(-2px); } }

/* Folds: reasoning, commands, tool calls */
.ag-fold { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.ag-fold-sum {
  display: flex; align-items: center; gap: 8px; min-height: 36px; min-width: 0; padding: 6px 12px;
  list-style: none; cursor: pointer; user-select: none; color: var(--text-2); font-size: 13px;
}
.ag-fold-sum::-webkit-details-marker { display: none; }
.ag-fold-sum:hover { background: var(--surface-2); }
.ag-fold-sum:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
.ag-chev, .df-chev {
  flex: none; width: 7px; height: 7px; margin: 0 3px 0 1px;
  border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3);
  transform: rotate(-45deg); transition: transform 150ms var(--ease);
}
details[open] > summary > .ag-chev, details[open] > summary > .df-chev { transform: rotate(45deg); }
.ag-fold-kind { flex: none; color: var(--text); font-weight: 500; white-space: nowrap; }
.ag-fold-hint { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.ag-fold-hint.mono { font-size: 12px; }
.ag-fold-meta { flex: none; margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.ag-fold-body { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.ag-glyph { display: inline-grid; place-items: center; flex: none; width: 16px; height: 16px; }
.ag-glyph.spinner { width: 13px; height: 13px; margin: 0 1.5px; }

.ag-reasoning { border-color: transparent; background: transparent; }
.ag-reasoning > .ag-fold-sum { min-height: 30px; padding: 4px 6px; color: var(--text-3); }
.ag-reasoning > .ag-fold-sum .ag-fold-kind { color: var(--text-3); font-weight: 500; }
.ag-reasoning > .ag-fold-sum > .icon { color: var(--text-4); }
.ag-reasoning-body { margin: 2px 0 8px 12px; padding: 2px 0 2px 14px; border-left: 2px solid var(--border); color: var(--text-2); font-size: 13.5px; }

.ag-cmd-line { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 12.5px; }
.ag-cmd.is-failed { border-color: color-mix(in srgb, var(--crit) 28%, var(--border)); }
.ag-cmd-full { display: flex; align-items: flex-start; gap: 6px; }
.ag-cmd-text { flex: 1 1 auto; min-width: 0; margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--code-bg); border: 1px solid var(--border); color: var(--text); font: 12.5px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.ag-cmd-cwd { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; }
.ag-tail { margin: 4px 0 0 34px; max-height: 4.6em; overflow: hidden; color: var(--text-3); font: 11.5px/1.5 var(--mono); white-space: pre; text-overflow: ellipsis; }
.ag-out-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ag-out-head { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 4px 0 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font-size: 11.5px; }
.ag-out-head .btn { height: 26px; width: 26px; }
.ag-trunc { padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 11px; }
.ag-out { margin: 0; max-height: 360px; padding: 9px 12px; overflow: auto; background: var(--code-bg); color: var(--text-2); font: 12.5px/1.55 var(--mono); white-space: pre; tab-size: 4; }
.ag-out:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ag-out.is-error { color: var(--text); }
.ag-out-empty { color: var(--text-3); font-size: 12.5px; }

.ag-files { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.ag-files-head { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 12px; color: var(--text-2); font-size: 13px; }
.ag-files-head .df-plus, .ag-files-head .df-minus { font: 12px var(--mono); }
.ag-files > .df { border-top: 1px solid var(--border); }

.ag-plan { padding: 10px 12px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.ag-plan-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; color: var(--text-2); }
.ag-plan-head .ag-fold-meta { margin-left: 0; }
.ag-steps { display: flex; flex-direction: column; gap: 2px; }
.ag-steps li { display: flex; align-items: flex-start; gap: 10px; padding: 3px 0; font-size: 13.5px; color: var(--text); }
.ag-step-mark { display: inline-grid; place-items: center; flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 1.5px solid var(--border-strong); color: var(--ok); }
.ag-steps .is-done .ag-step-mark { border-color: transparent; background: var(--ok-soft); }
.ag-steps .is-done .ag-step-text { color: var(--text-3); }
.ag-steps .is-active .ag-step-mark { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 8px var(--accent); }
.ag-steps .is-active .ag-step-text { font-weight: 500; }

.ag-line { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 2px; color: var(--text-2); font-size: 13px; }
.ag-line > .icon { color: var(--text-3); flex: none; }
.ag-link { color: var(--accent-text); text-decoration: none; }
.ag-link:hover { text-decoration: underline; text-underline-offset: 2px; }

.ag-error { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--crit) 24%, transparent); border-radius: 10px; background: var(--crit-soft); color: var(--text); font-size: 13.5px; }
.ag-error > .icon { color: var(--crit); margin-top: 1px; flex: none; }
.ag-error-text { min-width: 0; overflow-wrap: anywhere; }
.ag-error-text.mono { font-size: 12.5px; }

.ag-system { display: flex; align-items: center; gap: 10px; padding: 4px 0; color: var(--text-3); font-size: 12px; }
.ag-system::before, .ag-system::after { content: ""; flex: 1 1 auto; border-top: 1px solid var(--border); }
.ag-system-time { color: var(--text-4); }

/* Approvals */
.ag-approval { margin-top: 8px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 12px; background: var(--warn-soft); }
.ag-approval.is-resolved { padding: 8px 12px; border-color: var(--border); background: var(--surface-2); }
.ag-approval-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.ag-approval-head > .icon { color: var(--warn); flex: none; }
.ag-approval.is-resolved .ag-approval-head > .icon { color: var(--text-3); }
.ag-approval-head .ag-fold-meta { margin-left: auto; }
.ag-approval-sum { margin-top: 6px; color: var(--text); font-size: 13.5px; overflow-wrap: anywhere; }
.ag-approval.is-resolved .ag-approval-sum { margin-top: 2px; color: var(--text-2); font-size: 12.5px; }
.ag-approval-reason { margin-top: 2px; color: var(--text-2); font-size: 12.5px; }
.ag-approval-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ag-btn-danger-ghost { border-color: color-mix(in srgb, var(--crit) 40%, var(--border-strong)); color: var(--crit); background: var(--surface); }
.ag-btn-danger-ghost:hover { background: var(--crit-soft); }

/* ---- Session: composer ---------------------------------------------------------------------- */

.ag-composer {
  position: sticky; bottom: var(--ag-bottom, 0px); z-index: 6;
  margin-top: 6px; padding: 8px 0 14px;
  background: var(--bg);
}
.ag-newpill {
  position: absolute; left: 50%; top: -42px; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
  font-size: 12.5px; font-weight: 500; cursor: pointer; transform: translateX(-50%);
}
.ag-run { display: flex; align-items: center; gap: 8px; padding: 0 4px 8px; color: var(--text-2); font-size: 12.5px; }
.ag-run .spinner { width: 12px; height: 12px; }
.ag-run-text { font-variant-numeric: tabular-nums; }
.ag-float { display: flex; flex-direction: column; gap: 8px; max-height: 42vh; margin-bottom: 8px; overflow: auto; }
.ag-float .ag-approval { margin-top: 0; }
.ag-peek { max-height: 38vh; margin: 0 0 8px; padding: 8px 10px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--code-bg); color: var(--text-2); font: 11.5px/1.45 var(--mono); white-space: pre; }
.ag-quick { display: flex; gap: 6px; padding: 0 0 8px; overflow-x: auto; scrollbar-width: none; }
.ag-quick::-webkit-scrollbar { display: none; }
.ag-qk {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: none;
  min-width: 36px; height: 30px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text-2); font: 500 12.5px/1 var(--mono); cursor: pointer;
}
.ag-qk:hover { background: var(--surface-2); color: var(--text); }
.ag-qk:disabled { opacity: 0.5; }
.ag-qk-peek { font-family: var(--font); }
.ag-qk[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

.ag-box {
  display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px;
  border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface);
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.ag-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ag-input {
  flex: 1 1 auto; min-width: 0; min-height: 34px; max-height: 40vh; margin: 0; padding: 7px 0;
  border: 0; outline: 0; resize: none; background: transparent; color: var(--text);
  font: 14.5px/1.45 var(--font);
}
.ag-input::placeholder { color: var(--text-4); }
.ag-input:disabled { cursor: not-allowed; }
.ag-box-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.ag-send, .ag-stop { height: 34px; border-radius: 10px; }
.ag-send.is-steer { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.ag-hint { display: flex; flex-wrap: wrap; gap: 4px 14px; min-height: 0; padding: 6px 6px 0; color: var(--text-4); font-size: 11.5px; }
.ag-hint:empty { display: none; }
.ag-composer[data-mode="blocked"] .ag-hint { align-items: center; color: var(--warn); }
.ag-composer[data-mode="blocked"] .ag-box { background: var(--surface-2); }

.ag-resume-card { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); }
.ag-resume-text strong { display: block; font-size: 14px; font-weight: 600; }
.ag-resume-text p { margin-top: 2px; color: var(--text-2); font-size: 13px; }
.ag-resume-cmd { color: var(--text-3); font-size: 12px; overflow-wrap: anywhere; }
.ag-resume-cmd .mono { font-size: 11.5px; }
.ag-resume-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ag-resume-opt { display: flex; flex-direction: column; gap: 4px; color: var(--text-3); font-size: 12px; }
.ag-resume-opt .input-sm { width: 100%; max-width: none; }
.ag-resume-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }

/* ---- Markdown ---------------------------------------------------------------------------------- */

.md { min-width: 0; font-size: 14.5px; line-height: 1.65; color: var(--text); overflow-wrap: anywhere; }
.md > * + *, .md li > * + * { margin-top: 0.7em; }
.md p, .md ul, .md ol, .md blockquote { margin: 0; }
.md .md-h { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; color: var(--text); }
.md > .md-h:not(:first-child) { margin-top: 1.25em; }
.md .md-h1 { font-size: 1.25em; }
.md .md-h2 { font-size: 1.13em; }
.md .md-h3 { font-size: 1.03em; }
.md .md-h4, .md .md-h5, .md .md-h6 { font-size: 1em; color: var(--text-2); }
.md ul, .md ol { padding-left: 1.45em; }
.md ul { list-style: disc; }
.md ul ul { list-style: circle; }
.md ol { list-style: decimal; }
.md li + li { margin-top: 0.3em; }
.md li::marker { color: var(--text-3); }
.md ul.md-tasks { list-style: none; padding-left: 0.2em; }
.md .md-task { position: relative; padding-left: 1.65em; }
.md-check { position: absolute; left: 0; top: 0.28em; width: 14px; height: 14px; border: 1.5px solid var(--border-strong); border-radius: 4px; }
.md-check.is-done { border-color: var(--ok); background: var(--ok); }
.md-check.is-done::after { content: ""; position: absolute; left: 3.5px; top: 0.5px; width: 3.5px; height: 7px; border: solid var(--surface); border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); }
.md strong { font-weight: 600; }
.md s { color: var(--text-3); }
.md a { color: var(--accent-text); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 2px; }
.md a:hover { text-decoration-color: currentColor; }
.md :not(pre) > code { padding: 0.1em 0.38em; border-radius: 5px; background: var(--surface-2); color: var(--text); font: 0.86em/1.4 var(--mono); overflow-wrap: anywhere; }
.md-ref { border-bottom: 1px dotted var(--border-strong); color: var(--text); cursor: help; }
.md-img { font-size: 0.92em; }
.md blockquote { padding: 0.1em 0 0.1em 0.9em; border-left: 2px solid var(--border-strong); color: var(--text-2); }
.md hr { height: 0; margin: 1.3em 0; border: 0; border-top: 1px solid var(--border); }
.md-code { position: relative; border: 1px solid var(--border); border-radius: 10px; background: var(--code-bg); overflow: hidden; }
.md-code-head { display: flex; align-items: center; justify-content: space-between; min-height: 30px; padding: 0 4px 0 12px; border-bottom: 1px solid var(--border); color: var(--text-3); font-size: 11.5px; }
.md-code-head .btn { width: 26px; height: 26px; }
.md-code-lang { font-family: var(--mono); letter-spacing: 0.02em; }
.md-code pre { margin: 0; padding: 10px 12px; overflow: auto; color: var(--text); font: 12.5px/1.55 var(--mono); white-space: pre; tab-size: 4; }
.md-code pre code { font: inherit; }
.md-code.is-folded pre { max-height: calc(24 * 1.55 * 12.5px + 20px); overflow: hidden; }
.md-code-more { display: block; width: 100%; height: 32px; border: 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--accent-text); font-size: 12.5px; cursor: pointer; }
.md-code-more:hover { background: var(--surface-2); }
.md-table { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.md-table table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.5; }
.md-table th, .md-table td { padding: 7px 12px; text-align: left; vertical-align: top; }
.md-table th { background: var(--surface-2); color: var(--text-2); font-weight: 600; white-space: nowrap; }
.md-table tr + tr td, .md-table tbody tr:first-child td { border-top: 1px solid var(--border); }
.md-table .md-al-center { text-align: center; }
.md-table .md-al-right { text-align: right; }
.md.is-streaming > :is(p, .md-h, ul, ol):last-child::after,
.md.is-streaming > :is(ul, ol):last-child > li:last-child::after {
  content: ""; display: inline-block; width: 0.5em; height: 1.05em; margin-left: 2px;
  background: var(--text-3); vertical-align: text-bottom; animation: ag-caret 1s steps(1) infinite;
}
.md.is-streaming > :is(ul, ol):last-child::after { content: none; }
@keyframes ag-caret { 50% { opacity: 0; } }

/* ---- Diff -------------------------------------------------------------------------------------- */

.df { min-width: 0; }
.df-file + .df-file { border-top: 1px solid var(--border); }
.df-head { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 12px; list-style: none; cursor: pointer; font-size: 12.5px; }
.df-head::-webkit-details-marker { display: none; }
.df-head:hover { background: var(--surface-2); }
.df-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.df-badge { flex: none; min-width: 18px; padding: 0 4px; border-radius: 4px; text-align: center; font: 600 10.5px/17px var(--mono); background: var(--accent-soft); color: var(--accent-text); }
.df-s-add .df-badge { background: var(--ok-soft); color: var(--ok); }
.df-s-delete .df-badge { background: var(--crit-soft); color: var(--crit); }
.df-s-rename .df-badge { background: var(--warn-soft); color: var(--warn); }
.df-path { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font: 12.5px var(--mono); direction: ltr; }
.df-old { color: var(--text-3); }
.df-arrow { color: var(--text-4); }
.df-stats { display: flex; gap: 6px; flex: none; font: 12px var(--mono); }
.df-plus { color: var(--ok); }
.df-minus { color: var(--crit); }
.df-bin { color: var(--text-3); font-family: var(--font); }
.df-body { border-top: 1px solid var(--border); background: var(--code-bg); font: 12px/1.6 var(--mono); }
.df-hunk { padding: 3px 12px; background: var(--surface-2); color: var(--text-3); font: 11.5px/1.7 var(--font); }
.df-hunk + .df-line, .df-line + .df-hunk { border-top: 1px solid var(--border); }
.df-line { display: grid; grid-template-columns: minmax(2.8em, max-content) minmax(2.8em, max-content) 1.5em minmax(0, 1fr); }
.df-no { padding: 0 6px 0 8px; color: var(--text-4); text-align: right; user-select: none; font-size: 11px; }
.df-sign { color: var(--text-4); text-align: center; user-select: none; }
.df-text { min-width: 0; padding-right: 12px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.df-line.df-add { background: color-mix(in srgb, var(--ok) 9%, transparent); }
.df-line.df-del { background: color-mix(in srgb, var(--crit) 8%, transparent); }
.df-line.df-add .df-sign { color: var(--ok); }
.df-line.df-del .df-sign { color: var(--crit); }
.df-line.df-add .df-text, .df-line.df-del .df-text { color: var(--text); }
.df-chg { border-radius: 2px; color: inherit; }
.df-line.df-add .df-chg { background: color-mix(in srgb, var(--ok) 24%, transparent); }
.df-line.df-del .df-chg { background: color-mix(in srgb, var(--crit) 22%, transparent); }
.df-line.df-meta { display: block; padding: 1px 12px 1px calc(5.6em + 36px); color: var(--text-3); font-style: italic; }
.df-more { display: block; width: 100%; height: 32px; border: 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--accent-text); font: 12.5px var(--font); cursor: pointer; }
.df-note { padding: 10px 12px; color: var(--text-3); font: 12.5px var(--font); white-space: pre-wrap; }
.df-plain .df-pl { display: block; min-height: 1.55em; }
.df-plain .df-add { background: color-mix(in srgb, var(--ok) 10%, transparent); color: var(--text); }
.df-plain .df-del { background: color-mix(in srgb, var(--crit) 9%, transparent); color: var(--text); }
.df-plain .df-fh { color: var(--text-3); }
.df-plain .df-hunk-inline { color: var(--accent-text); }

/* ---- Terminal ---------------------------------------------------------------------------------- */

main.page.ag-main-term, main.page[data-view="terminal"] { padding-bottom: 0; }
.tm-host { min-width: 0; }
.tm {
  display: flex; flex-direction: column; min-height: 220px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--code-bg);
}
.tm-bar { display: flex; align-items: center; gap: 6px; min-height: 46px; padding: 5px 6px 5px 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.tm-back { flex: none; color: var(--text-2); }
.tm-title { display: flex; flex-direction: column; min-width: 0; flex: 0 1 auto; margin-right: 4px; }
.tm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font: 600 13px/1.3 var(--mono); }
.tm-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 11.5px; }
.tm-sub:empty { display: none; }
.tm-status { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.tm .segmented.tm-mode { flex: none; margin: 0; padding: 2px; }
.tm-mode .seg { padding: 4px 10px; font-size: 12.5px; }
.tm-tools { display: flex; align-items: center; gap: 0; flex: none; }
.tm-tools .btn[aria-pressed="true"] { color: var(--accent-text); background: var(--accent-soft); }
.tm-search { display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.tm-search-input { flex: 1 1 auto; max-width: 380px; height: 30px; }
.tm-search-count { min-width: 3.5em; color: var(--text-3); font-size: 12px; text-align: right; }
.tm-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.tm-screen { position: absolute; inset: 0; padding: 6px 2px 2px 10px; }
.tm-screen .xterm { height: 100%; }
/* xterm.css paints the legacy viewport black; the theme background lives on the scrollable
   element, so let the pane's own background show through regardless of stylesheet order. */
.tm .tm-screen .xterm .xterm-viewport { background-color: transparent; }
.tm-overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--code-bg) 78%, transparent); }
.tm-overlay-card { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 360px; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-pop); text-align: center; }
.tm-overlay-card strong { font-size: 14px; font-weight: 600; }
.tm-overlay-card p { color: var(--text-2); font-size: 13px; }
.tm-overlay-actions { display: flex; gap: 8px; margin-top: 8px; }
.tm-keywrap { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-top: 1px solid var(--border); background: var(--surface); }
.tm-keys { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tm-keys::-webkit-scrollbar { display: none; }
.tm-key {
  flex: none; min-width: 44px; height: 38px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  color: var(--text); font: 500 13px/1 var(--mono); cursor: pointer; touch-action: manipulation;
}
.tm-key:active { background: var(--surface-2); }
.tm-key-wide { font-family: var(--font); }
.tm-key[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.tm-key:disabled { opacity: 0.45; cursor: not-allowed; }
.tm-line { display: flex; gap: 6px; }
.tm-line-input { flex: 1 1 auto; height: 38px; font-family: var(--mono); font-size: 13px; }
.tm-line-send { flex: none; width: 38px; height: 38px; }
.tm.is-max { position: fixed; inset: 0; z-index: 70; border: 0; border-radius: 0; }
body.tm-max-open { overflow: hidden; }
.tm.is-fullscreen { border-radius: 0; }
.tm-compact { border-radius: var(--radius); }

.modal.tm-history-dialog { width: min(980px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; overflow: hidden; }
.modal.tm-history-dialog:not([open]) { display: none; }
.tm-history-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); }
.tm-history-title { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; font-size: 13.5px; }
.tm-history-title .faint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.tm-history { flex: 1 1 auto; margin: 0; padding: 12px 16px; overflow: auto; background: var(--code-bg); color: var(--text); font: 12px/1.5 var(--mono); white-space: pre; user-select: text; }
.tm-paste-area { font-family: var(--mono); font-size: 13px; }

/* ---- Terminaller (list) -------------------------------------------------------------------- */

.tl > * + * { margin-top: 24px; }
.tl-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tl-group-head h2 { font-size: 14px; font-weight: 600; }
.tl-count { margin-left: auto; color: var(--text-3); font-size: 12.5px; }
.tl-list { overflow: hidden; }
.tl-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: start; gap: 6px 12px; padding: 12px 12px 12px 16px; }
.tl-row + .tl-row { border-top: 1px solid var(--border); }
.tl-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); }
.tl-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tl-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.tl-name { color: var(--text); font-size: 13.5px; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.tl-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.tl-agent { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); font-size: 12px; font-weight: 500; text-decoration: none; }
.tl-agent:hover { text-decoration: underline; text-underline-offset: 2px; }
.tl-panes { display: flex; flex-direction: column; gap: 1px; }
.tl-pane { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 12.5px; }
.tl-cmd { flex: none; color: var(--text-2); font-size: 12px; }
.tl-cwd { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 12px; }
.tl-dead { flex: none; color: var(--text-3); font-size: 12px; }
.tl-pane.is-dead .tl-cmd { color: var(--text-3); }
.tl-meta { color: var(--text-3); font-size: 12px; }
.tl-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.tl-kill:hover { color: var(--crit); }

/* ---- Tablet & phone ------------------------------------------------------------------------ */

@media (max-width: 1023px) {
  .ag-head-meta { padding-left: 0; }
  .ag-tabs { margin-left: 0; }
}

@media (max-width: 719px) {
  .ag-hide-sm { display: none !important; }

  .ag-toolbar { gap: 8px; }
  .ag-search { flex-basis: 100%; }
  .ag-toolbar .ag-seg { flex: 1 1 auto; }
  .ag-selects { flex: 1 1 100%; }
  .ag-selects .input-sm { flex: 1 1 0; max-width: none; height: 38px; min-width: 0; }

  .ag-row { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 3px 10px; padding: 12px 14px; }
  .ag-row-main { display: contents; }
  .ag-row > .ag-mark { grid-row: 1 / span 3; }
  .ag-row-top { grid-column: 2; grid-row: 1; flex-wrap: wrap; row-gap: 4px; }
  .ag-row-title { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  .ag-row-end { grid-column: 3; grid-row: 1; flex-direction: column; font-size: 12px; }
  .ag-row-live { display: none; }
  .ag-row-meta { grid-column: 2 / -1; grid-row: 2; }
  .ag-row-conflict { grid-column: 2 / -1; grid-row: 3; }

  .ag-new-sec { padding: 16px 14px; }
  .ag-kinds { gap: 6px; }
  .seg.ag-kind { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px; }
  .ag-kind .seg-sub { display: none; }
  .ag-proj { gap: 10px; }
  .ag-proj-badges { max-width: 42%; }
  .ag-kv { gap: 10px 14px; }
  .ag-opt-select { max-width: 100%; width: 100%; }
  .ag-new-actions { padding: 14px; }
  .ag-new-actions > .form-error { order: 1; }
  .ag-new-actions > .ag-start { order: 2; flex: 1 1 100%; min-width: 0; }
  .ag-new-actions > .btn:not(.ag-start) { order: 3; flex: 1 1 100%; }

  .ag-back .ag-back-text { display: none; }
  .ag-back { width: 38px; padding: 0; }
  .ag-head-row { gap: 8px; }
  .ag-title { font-size: 16px; }
  .ag-conn-text { display: none; }
  .ag-head-meta { gap: 2px 12px; font-size: 12px; }
  .ag-k-user { max-width: 90%; }
  .ag-bubble, .md, .ag-plain { font-size: 15px; }
  .ag-msg-actions { opacity: 0.8; }
  .ag-fold-sum { min-height: 40px; }
  .ag-tail { margin-left: 12px; }
  .ag-out { max-height: 300px; font-size: 12px; }
  .ag-composer { padding: 6px 0 8px; }
  .ag-sess.is-kb .ag-composer { padding-bottom: 6px; }
  .ag-box { padding: 5px 5px 5px 12px; border-radius: 16px; }
  .ag-input { font-size: 16px; line-height: 1.4; min-height: 38px; }
  .ag-send, .ag-stop { height: 38px; border-radius: 12px; }
  .ag-send:not(.is-steer) .ag-send-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ag-send:not(.is-steer) { width: 40px; padding: 0; }
  .ag-stop > span { display: none; }
  .ag-stop { width: 40px; padding: 0; }
  .ag-hint { display: none; }
  .ag-composer[data-mode="blocked"] .ag-hint { display: flex; }
  .ag-qk { height: 36px; min-width: 40px; }
  .ag-peek { max-height: 32vh; }
  .ag-resume-opts { grid-template-columns: minmax(0, 1fr); }
  .ag-resume-actions > .btn { flex: 1; }
  .ag-approval-actions > .btn { flex: 1 1 auto; }

  .df-line { grid-template-columns: minmax(2.4em, max-content) minmax(2.4em, max-content) 1.3em minmax(0, 1fr); }
  .df-line.df-meta { padding-left: 12px; }

  main.page.ag-main-term, main.page[data-view="terminal"] { padding-left: 0; padding-right: 0; padding-top: 0; }
  .tm { border-left: 0; border-right: 0; border-radius: 0; }
  .ag-sess.is-term .ag-head-meta { display: none; }
  .ag-sess.is-term .tm { border-left: 0; border-right: 0; border-radius: 0; }
  .ag-sess.is-term .ag-termpanel { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }
  /* Phone toolbar: back · title · status on the first row; mode + tools (scrollable, most
     used first) on the second. The compact (session tab) bar stays one row. */
  .tm-bar { flex-wrap: wrap; row-gap: 4px; }
  .tm-title { flex: 1 1 0; }
  .tm:not(.tm-compact) .tm-bar > .grow { flex: 1 1 100%; height: 0; }
  .tm-status .tm-status-text { display: none; }
  .tm-tools { flex: 1 1 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .tm-tools::-webkit-scrollbar { display: none; }
  .tm-tools > .tm-t-max { margin-left: auto; }
  .tm-tools .btn-icon { flex: none; width: 40px; }
  .tm-t-max { order: 1; }
  .tm-t-history { order: 2; }
  .tm-t-keyboard { order: 3; }
  .tm-t-search { order: 4; }
  .tm-t-copy { order: 5; }
  .tm-t-minus { order: 6; }
  .tm-t-plus { order: 7; }
  .tm-mode .seg { padding: 6px 12px; }
  .tm-line-input { font-size: 16px; }
  .modal.tm-history-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 24px); }

  .tl-row { grid-template-columns: 32px minmax(0, 1fr); padding: 12px 14px; }
  .tl-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .tl-actions > .btn:not(.btn-icon) { flex: 1 1 0; }
}

@media (pointer: coarse) {
  .ag-msg-actions { opacity: 0.8; }
  .ag-edit { width: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .ag-pill-dot.is-live, .ag-typing > span { animation: none !important; }
  .md.is-streaming > :is(p, .md-h, ul, ol):last-child::after { animation: none !important; }
}
