:root {
  color-scheme: dark;
  --bg: #0e0f12;
  --side: #121317;
  --panel: #16181d;
  --raise: #1d2026;
  --field: #101115;
  --line: #262931;
  --line2: #343844;
  --text: #e8e9ed;
  --muted: #969baa;
  --accent: #8b7cf6;
  --accent-hover: #9d90fa;
  --accent-soft: #8b7cf624;
  --green: #4ecb8b;
  --amber: #e5b454;
  --red: #f0736a;
  --radius: 10px;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 22px; letter-spacing: -.015em; }
h2 { font-size: 14px; }
h3 { font-size: 14px; }
.error { color: var(--red); }
.icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* buttons and fields */
.primary-btn, .ghost-btn, .danger-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 13px;
  border: 1px solid transparent; border-radius: 7px; font-weight: 550; font-size: 13px; transition: background .12s, border-color .12s;
}
.primary-btn { background: var(--accent); color: #100c26; font-weight: 600; }
.primary-btn:hover:not(:disabled) { background: var(--accent-hover); }
.ghost-btn { background: var(--raise); border-color: var(--line2); }
.ghost-btn:hover:not(:disabled) { background: #262a32; border-color: #454a58; }
.danger-btn { background: #c2463d; color: #fff; }
.quiet-danger { color: var(--red); }
.link-btn { padding: 4px 0; border: 0; background: none; color: var(--muted); font-size: 13px; }
.link-btn:hover { color: var(--text); }
.field-text, .field-textarea, .num, .dm-search, .watcher-actions select, #loginUsername, #loginPassword, .dialog input {
  min-height: 34px; padding: 6px 10px; background: var(--field); border: 1px solid var(--line2); border-radius: 7px;
}
.field-text:focus, .field-textarea:focus, .num:focus, .dm-search:focus, #loginUsername:focus, #loginPassword:focus, .dialog input:focus { border-color: var(--accent); outline: 0; }

/* sign in */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate-card { width: min(340px, 100%); padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.gate-card h1 { margin-bottom: 20px; font-size: 19px; }
.gate-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12.5px; }
#loginUsername, #loginPassword { width: 100%; min-height: 40px; }
#loginUsername { margin-bottom: 12px; }
.gate-note { min-height: 20px; margin: 8px 0; color: var(--muted); font-size: 12.5px; }
.gate-note.error { color: var(--red); }
#loginForm .primary-btn { width: 100%; min-height: 40px; }

/* shell */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.topbar { display: none; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 14px;
  padding: 18px 12px 14px; overflow-y: auto; background: var(--side); border-right: 1px solid var(--line);
}
.brand { padding: 0 8px; color: var(--text); font-size: 15px; font-weight: 650; text-decoration: none; }
.server-picker { position: relative; }
.server-button {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px 7px 8px; text-align: left;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 8px;
}
.server-button:hover { background: var(--raise); }
#accountName { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.chevron { width: 7px; height: 7px; margin: -4px 2px 0; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.server-icon {
  position: relative; display: grid; place-items: center; width: 26px; height: 26px; flex: none; overflow: hidden;
  border-radius: 50%; background: #2d2950; color: #d8d2ff; font-size: 11.5px; font-weight: 650;
}
.server-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.server-list {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; max-height: 55vh; overflow: auto;
  margin: 0; padding: 4px; list-style: none; background: var(--raise); border: 1px solid var(--line2);
  border-radius: 9px; box-shadow: 0 16px 40px #0009;
}
.server-list li button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px; background: none; text-align: left; }
.server-list li button:hover, .server-list li button[aria-selected="true"] { background: var(--accent-soft); }
.server-list li span:not(.server-icon) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-list .add-account-row { color: var(--accent); font-weight: 550; }
.state-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #565b69; }
.state-dot[data-state="connected"] { background: var(--green); }
.state-dot[data-state="starting"] { background: var(--amber); }
.state-dot[data-state="failed"], .state-dot[data-state="disconnected"] { background: var(--red); }
#nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { margin: 16px 8px 5px; color: #6d7280; font-size: 11.5px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 7px;
  background: none; color: #b8bcc8; text-align: left; font-weight: 500;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: #fff; }
.nav-item[aria-current="page"] .icon { color: var(--accent-hover); }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.bot-pill { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; }
.bot-pill b { font-weight: 500; }
.bot-pill i { width: 7px; height: 7px; border-radius: 50%; background: #565b69; }
.bot-pill[data-state="online"] i { background: var(--green); }
.bot-pill[data-state="offline"] { color: var(--red); }
.bot-pill[data-state="offline"] i { background: var(--red); }

/* page */
.main { width: 100%; max-width: 1040px; margin: 0 auto; padding: 32px 36px 64px; min-width: 0; }
.main:has(.dm-shell) { max-width: 1280px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 24px; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.watcher-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.watcher-actions select { min-width: 160px; }
.panel, .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card { padding: 18px 20px; }
.card-error { margin: 10px 0 0; }
.grid { display: grid; gap: 16px; align-items: start; }
.grid.cols2 { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 44px 20px; color: var(--muted); text-align: center; border: 1px dashed var(--line2); border-radius: var(--radius); }
.empty p { margin: 0; }

/* accounts */
.account-card { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.account-card + .account-card { border-top: 1px solid var(--line); }
.account-card .server-icon { width: 38px; height: 38px; font-size: 15px; }
.account-card .meta { flex: 1; min-width: 0; }
.meta strong, .meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta strong { font-weight: 600; }
.meta small { color: var(--muted); font-size: 12.5px; }
.meta small.error { color: var(--red); white-space: normal; }
.account-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.state-pill { flex: none; padding: 2px 9px; border-radius: 99px; background: #ffffff0b; color: var(--muted); font-size: 12px; font-weight: 550; }
.state-pill[data-state="connected"] { background: #4ecb8b1c; color: var(--green); }
.state-pill[data-state="starting"] { background: #e5b4541c; color: var(--amber); }
.state-pill[data-state="failed"], .state-pill[data-state="disconnected"] { background: #f0736a1c; color: var(--red); }

/* settings */
.setting-group + .setting-group { margin-top: 28px; }
.setting-group > h2 { margin-bottom: 10px; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 28px; padding: 16px 20px; transition: box-shadow .2s; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting.saved { box-shadow: inset 3px 0 0 var(--green); }
.setting.textarea { grid-template-columns: minmax(0, 1fr); }
.setting h3 { font-weight: 550; }
.setting-copy p { max-width: 58ch; margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.control { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.field-text { width: 260px; max-width: 100%; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; z-index: 1; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #363a45; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.slider { display: flex; align-items: center; gap: 10px; }
.slider input[type=range] { width: 180px; accent-color: var(--accent); }
.num { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.unit { min-width: 62px; color: var(--muted); font-size: 12.5px; }
.field-textarea { width: 100%; min-height: 96px; resize: vertical; line-height: 1.55; }
.persona-editor { grid-column: 1 / -1; min-width: 0; }
.persona-editor .field-textarea { min-height: 220px; }
.persona-editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.persona-count { flex: 1; min-width: 150px; color: var(--muted); font-size: 12px; }
.persona-count.over { color: var(--red); }

/* dialogs and toasts */
.dialog { width: min(440px, 92vw); padding: 22px; color: var(--text); background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 24px 70px #000b; }
.dialog::backdrop { background: #000a; }
.dialog h2 { margin-bottom: 8px; font-size: 16px; }
.dialog p { color: var(--muted); font-size: 13px; }
.dialog label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12.5px; }
.dialog input { display: block; width: 100%; margin-top: 5px; color: var(--text); }
.dialog p.error { color: var(--red); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toasts { position: fixed; z-index: 60; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { padding: 11px 14px; background: var(--raise); border: 1px solid var(--line2); border-left: 3px solid var(--accent); border-radius: 8px; box-shadow: 0 12px 34px #0009; font-size: 13px; }
.toast[data-k="ok"] { border-left-color: var(--green); }
.toast[data-k="error"] { border-left-color: var(--red); }

/* diagnostics and activity */
.watcher-metrics { display: grid; grid-template-columns: auto minmax(0, 1fr); margin: 10px 0 0; font-size: 13px; }
.watcher-metrics dt, .watcher-metrics dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.watcher-metrics dt { padding-right: 20px; color: var(--muted); }
.watcher-metrics dd { text-align: right; overflow-wrap: anywhere; }
.watcher-metrics dt:last-of-type, .watcher-metrics dd:last-of-type { border-bottom: 0; }
.watcher-check { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; }
.watcher-check + .watcher-check { border-top: 1px solid var(--line); }
.watcher-check strong { font-weight: 550; }
.watcher-check p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.watcher-check-result { margin: 6px 0 0; font-size: 12.5px; }
.watcher-check-result:empty { display: none; }
.watcher-check p.watcher-pass { color: var(--green); }
.watcher-check p.error { color: var(--red); }
.watcher-recent-errors { margin-top: 16px; }
.watcher-recent-errors .empty { margin-top: 12px; padding: 22px; }
.feed { display: flex; flex-direction: column; max-height: 65vh; overflow: auto; }
.feed-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 9px 0; font-size: 13px; }
.feed-row + .feed-row { border-top: 1px solid var(--line); }
.feed-row time { min-width: 138px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.feed-row > span:last-child { flex: 1; min-width: 200px; overflow-wrap: anywhere; }
.tag { min-width: 104px; color: var(--muted); font-size: 12px; font-weight: 550; }
.tag[data-k="replied"], .tag[data-k="voice_reply"], .tag[data-k="text_reply"], .tag[data-k="dm_reply"] { color: var(--accent-hover); }
.tag[data-k="check"], .tag[data-k="recovery"] { color: var(--green); }
.tag[data-k="error"] { color: var(--red); }
.watcher-event-account { color: var(--muted); }

/* messages and transcripts */
.dm-shell {
  display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); height: max(460px, calc(100dvh - 180px));
  overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.dm-inbox, .dm-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dm-inbox { padding: 12px 8px 8px; background: var(--side); border-right: 1px solid var(--line); }
.dm-inbox-head, .dm-thread-head, .dm-thread-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dm-inbox-head { justify-content: space-between; margin-bottom: 10px; padding: 0 4px; }
.dm-thread-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; }
.dm-button { min-height: 28px; padding: 3px 9px; font-size: 12px; white-space: nowrap; }
.dm-search { width: 100%; font-size: 13px; }
.dm-inbox-note { margin: 8px 4px 0; color: var(--muted); font-size: 12px; }
.dm-inbox-note:empty { display: none; }
.dm-inbox-list { overflow: auto; margin-top: 8px; scrollbar-width: thin; }
.dm-conversation { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 8px; border: 0; border-radius: 7px; background: none; text-align: left; }
.dm-conversation:hover { background: var(--panel); }
.dm-conversation[aria-pressed="true"] { background: var(--accent-soft); }
.dm-conversation > span:last-child, .dm-thread-title > div { min-width: 0; }
.dm-conversation strong, .dm-conversation small, .dm-thread-title h2, .dm-thread-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-conversation strong { font-weight: 550; }
.dm-conversation small, .dm-thread-title small { color: var(--muted); font-size: 11.5px; }
.dm-avatar { position: relative; display: grid; place-items: center; width: 34px; height: 34px; flex: none; overflow: hidden; border-radius: 50%; background: #2d2950; color: #d8d2ff; font-size: 13px; font-weight: 650; }
.dm-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dm-thread-head { justify-content: space-between; min-height: 56px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.dm-back { display: none; }
.dm-timeline { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 10px 0; scrollbar-width: thin; }
.dm-timeline:focus-visible { outline-offset: -3px; }
.dm-empty { margin: 24px 12px; color: var(--muted); font-size: 13px; text-align: center; }
.dm-older { display: flex; margin: 4px auto 12px; }
.dm-date { display: flex; align-items: center; gap: 10px; margin: 14px 16px 8px; color: var(--muted); font-size: 11.5px; font-weight: 550; }
.dm-date::before, .dm-date::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.dm-message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 7px 16px 3px; }
.dm-message:hover { background: #ffffff05; }
.dm-grouped { padding-top: 0; }
.dm-msg-body { grid-column: 2; min-width: 0; }
.dm-msg-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px; font-size: 13px; }
.dm-msg-heading time, .dm-edited, .dm-muted, .transcript-entry .dm-msg-heading small { color: var(--muted); font-size: 11px; }
.dm-own { color: var(--accent-hover); font-size: 10.5px; white-space: nowrap; }
.dm-content, .dm-muted { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.dm-content { line-height: 1.45; }
.dm-spoiler { display: inline; padding: 1px 6px; border: 1px solid var(--line2); border-radius: 5px; background: var(--raise); font-size: .9em; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.dm-spoiler:hover { border-color: var(--accent); }
.dm-spoiler[aria-expanded="true"] { background: var(--accent-soft); font-size: inherit; }
.dm-spoiler-file { min-height: 44px; padding-inline: 12px; }
.dm-call { display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; margin-top: 4px; padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--raise); font-size: 13px; }
.dm-call-icon { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 6px; color: var(--accent); background: var(--accent-soft); }
.dm-call[data-state="missed"] .dm-call-icon { color: var(--red); background: #f0736a1c; }
.dm-call-duration { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dm-forwarded, .dm-reference { border-left: 2px solid #8b7cf680; border-radius: 0 6px 6px 0; background: #ffffff05; }
.dm-forwarded { margin: 4px 0; padding: 5px 9px; }
.dm-forwarded > small { display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; }
.dm-reference { display: flex; gap: 7px; margin: 2px 0 3px; padding: 3px 6px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.dm-reference b { flex: none; max-width: 38%; overflow: hidden; text-overflow: ellipsis; }
.dm-attachments { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 7px; margin: 5px 0; }
.dm-file { color: var(--accent-hover); font-size: 13px; overflow-wrap: anywhere; }
.dm-image-link { display: block; max-width: min(340px, 100%); }
.dm-image-link img { display: block; max-width: 100%; max-height: 300px; border-radius: 8px; }
.dm-audio { max-width: 100%; min-width: 0; }
.dm-audio audio { display: block; width: min(280px, 100%); height: 40px; }
.transcript-server { margin: 12px 8px 4px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.transcript-channel { min-height: 34px; }
.transcript-channel-icon { width: 18px; color: var(--muted); text-align: center; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--side); border-bottom: 1px solid var(--line); }
  .topbar b { font-weight: 600; }
  .icon-btn { width: 36px; height: 36px; border: 1px solid var(--line2); border-radius: 7px; background: var(--panel); }
  .sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(280px, 86vw); visibility: hidden; transform: translateX(-100%); transition: transform .2s, visibility .2s; }
  body.menu-open .sidebar { visibility: visible; transform: none; box-shadow: 20px 0 60px #000a; }
  body.menu-open::after { content: ""; position: fixed; z-index: 45; inset: 0; background: #0009; }
  .nav-item { padding-block: 9px; }
  .main { padding: 20px 14px 48px; }
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 20px; }
}
@media (max-width: 640px) {
  .account-card { flex-wrap: wrap; gap: 10px 12px; padding: 14px; }
  .account-card .meta { flex-basis: calc(100% - 110px); }
  .account-card .state-pill { order: 3; }
  .account-card .account-actions { order: 4; flex-basis: 100%; }
  .manageable-account .meta { flex-basis: calc(100% - 110px); }
  .setting { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .setting:has(> .control > .switch) { grid-template-columns: minmax(0, 1fr) auto; }
  .control { justify-content: flex-start; }
  .control .field-text { width: 100%; }
  .slider { width: 100%; }
  .slider input[type=range] { flex: 1; width: auto; min-width: 0; }
  .unit { min-width: 0; }
  .main:has(.dm-shell) { padding: 12px 12px 14px; }
  .main:has(.dm-shell) .page-head { margin-bottom: 10px; }
  .dm-shell { display: block; height: max(400px, calc(100dvh - 140px)); }
  .dm-inbox, .dm-thread { height: 100%; }
  .dm-shell:not(.dm-open) .dm-thread, .dm-shell.dm-open .dm-inbox { display: none; }
  .dm-back { display: inline-flex; }
  .dm-thread-head { gap: 7px; padding-inline: 9px; }
  .dm-thread-title { flex: 1; }
  .dm-message { gap: 8px; padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.brand-banner img { display: block; width: 100%; height: auto; }
.brand img { display: block; width: min(180px, 100%); height: auto; }
.gate-card { border-top-color: #e91e86; }

.brat-ops{margin-bottom:14px}
.brat-ops>p,.brat-ops>label{display:block;margin:10px 0}
.brat-annotation{display:block;margin-top:4px;color:var(--muted)}
.brat-preview{white-space:pre-wrap;overflow-wrap:anywhere;padding:12px;margin-top:10px;background:var(--field);border-radius:7px}
.brat-preview:empty{display:none}
.brat-filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,160px),1fr));gap:12px;margin-bottom:12px}
.brat-filters label{display:grid;gap:5px;min-width:0}
.brat-filters :is(input,select){width:100%;min-width:0}
.brat-transcript-match{color:var(--accent);font-weight:650}

/* Workspace navigation */
@media (min-width: 861px) {
  .app { grid-template-columns: 218px minmax(0,1fr); }
  .sidebar { grid-column: 1; grid-row: 1; }
  .main { grid-column: 2; grid-row: 1; max-width: none; margin: 0; padding: 30px clamp(28px,3vw,58px) 60px; }
  .main:has(.dm-shell) { max-width: none; }
}
#view { width: 100%; max-width: 1180px; }
#view:has(.dm-shell) { max-width: 1390px; }
#nav { gap: 4px; }
.nav-item { padding: 10px; }
#sectionNav:not([hidden]) { display:flex; gap: 20px; overflow-x:auto; margin-bottom: 23px; border-bottom: 1px solid var(--line); }
.section-tab { border: 0; border-bottom: 2px solid transparent; white-space: nowrap; padding: 8px 2px 11px;
  background: transparent; color: var(--muted); font-size: 13px; }
.section-tab:hover { color:var(--text); }
.section-tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight:650; }
.sandbox-grid { display:grid; grid-template-columns:minmax(0,1.3fr) minmax(0,1fr); gap: 16px; align-items:start; }
.sandbox-form,.sandbox-result { padding: 20px; min-width: 0; }
.sandbox-field { display:grid; gap:7px; }
.sandbox-field strong { font-size:13px; }
.sandbox-context { margin:14px 0; padding:12px; border:1px solid var(--line); border-radius:8px; }
.sandbox-context summary { color:var(--muted); cursor:pointer; }
.sandbox-context[open] .sandbox-field { margin-top:12px; }
.sandbox-actions,.sandbox-result-head { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.sandbox-actions small { color:var(--muted); }
.sandbox-result-head h2 { font-size:15px; }
.sandbox-route { color:var(--accent-hover); background:var(--accent-soft); padding:3px 8px; border-radius:5px; font-size:12px; }
.sandbox-output { min-height:130px; padding:14px; margin:14px 0 0; border-radius:8px; background:var(--field);
  white-space:pre-wrap; overflow-wrap:anywhere; }
@media (max-width:720px) { .sandbox-grid { grid-template-columns:minmax(0,1fr); } }

.setting-readonly { color: var(--muted); overflow-wrap: anywhere; }
