/* The ticket toolbar (GitHub issue 488, stage 1; docs/adr/0240; public/js/app/ticket-toolbar.js). The top of a staff
   ticket: the number, the title and its chips on the first line; under them a labeled toolbar of up to six buttons
   (Assign to me, Escalate and Resolve unless an Administrator chose others), then More, on one line that never wraps
   (what doesn't fit moves into More, whole), with "All changes saved" at the right. The Record workspace
   (docs/adr/0387-record-workspace-ticket-page.md) puts the bar at the right end of the title row: it measures the room
   its own box is given there (ticket-toolbar.js tbFit), so it keeps to one line beside the title too. Resolve (Reopen)
   is the one filled button; the others and More are outlined, 32 px high on a computer and 44 px where it is touched.
   Colors are the palette's tokens (styles.css), so the dark theme follows. */

/* The old ••• menu and the old two buttons are parked: the files that fill them still do, nobody sees them. */
#detailMoreMenu, .tp .tw-actions { display:none !important; }

/* ---------- The header: the title line, then the bar ---------- */
.tp > .detail-header.tb-header { row-gap:var(--space-100); }
.tp > .detail-header.tb-header > .tp-title-column { flex:1 1 100%; }
.tp > .detail-header.tb-header > .detail-actions { flex:1 1 100%; min-width:0; flex-wrap:nowrap; justify-content:space-between; }
.tp > .detail-header.tb-header .detail-save-status { flex:0 0 auto; flex-basis:auto; }
/* The bar's box may shrink to nothing (min-width:0), so it is only as wide as its place: what it measures as its room. */
.tb-wrap { flex:1 1 auto; min-width:0; }
.tb-bar { display:flex; flex-wrap:nowrap; align-items:center; gap:var(--space-100); min-width:0; }
.tb-bar [hidden], .tb-wrap [hidden] { display:none !important; }
/* One line each, 32 px high: no padding above or below, the words' own line height centered. A label is never cut (a
   button that doesn't fit moves into More whole) and never wraps inside its button. */
.tb-bar .tb-button, .tb-bar .tb-more { flex:0 0 auto; min-height:32px; padding:0 var(--space-150); border-radius:var(--radius-lg); font-size:var(--text-md); line-height:var(--leading-tight); white-space:nowrap; }
.tb-bar .tb-button.is-greyed { opacity:.55; cursor:not-allowed; }
.tb-bar .tb-button.is-greyed:focus-visible { opacity:1; }
/* More's chevron: the same drawn chevron as every button that opens a menu (components.css .drop-chevron), turned up
   while More is open. Drawn, not a character, so a screen reader says "More" alone. */
.tb-bar .tb-more::after { content:""; display:inline-block; flex:none; width:var(--space-75); height:var(--space-75); margin:0 var(--space-25); border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; color:var(--muted); transform:rotate(45deg) translateY(-2px); transition:transform .15s; }
.tb-bar .tb-more[aria-expanded="true"]::after { transform:rotate(225deg) translate(-1px,-1px); }
@media (prefers-reduced-motion: reduce) { .tb-bar .tb-more::after { transition:none; } }
.tb-copy-field { width:min(28rem, 100%); margin-top:var(--space-75); }

/* ---------- Watch, beside the title ---------- */
.tb-watch { display:inline-flex; align-items:center; gap:var(--space-50); padding:var(--space-25) var(--space-100); border:1px solid var(--line); border-radius:var(--radius-pill); background:var(--surface); color:var(--ink-2); font-size:var(--text-sm); font-weight:var(--weight-semibold); line-height:var(--leading-normal); white-space:nowrap; cursor:pointer; }
.tb-watch::before { content:""; width:.55rem; height:.55rem; border:2px solid currentColor; border-radius:var(--radius-round); }
.tb-watch[aria-pressed="true"] { border-color:color-mix(in srgb, var(--spruce) 40%, var(--line)); background:var(--spruce-pale); color:var(--spruce-dark); }
.tb-watch[aria-pressed="true"]::before { background:currentColor; }
.tb-watch[hidden] { display:none; }

/* ---------- More ---------- */
.tb-menu { position:fixed; z-index:calc(var(--z-page, 20) + 30); width:20rem; max-width:20rem; max-width:min(20rem, calc(100vw - 2rem)); overflow-y:auto; overscroll-behavior:contain; padding:var(--space-75) 0; border:1px solid var(--line-strong); border-radius:var(--radius-xl); background:var(--surface); box-shadow:var(--shadow-pop); }
.tb-menu[hidden] { display:none; }
.tb-group { padding:var(--space-50) 0; }
.tb-group + .tb-group { border-top:1px solid var(--line); }
.tb-group[data-group="urgent"] { border-top:2px solid var(--line-strong); margin-top:var(--space-50); }
.tb-group-heading { margin:0; padding:var(--space-75) var(--space-200) var(--space-50); color:var(--muted); font-size:var(--text-xs); font-weight:var(--weight-semibold); letter-spacing:.02em; text-transform:uppercase; }
.tb-group[data-group="urgent"] .tb-group-heading { color:var(--bad); }
.tb-menu .tb-item { display:grid; grid-template-columns:1fr auto; align-items:baseline; gap:var(--space-25) var(--space-150); width:100%; padding:var(--space-100) var(--space-200); border:0; background:transparent; color:var(--ink); font-size:var(--text-md); text-align:left; white-space:normal; overflow-wrap:anywhere; cursor:pointer; }
.tb-menu .tb-item:hover, .tb-menu .tb-item:focus-visible { background:var(--hover-bg); outline:none; box-shadow:inset 3px 0 0 var(--spruce); }
.tb-menu .tb-item kbd { justify-self:end; padding:0 var(--space-50); border:1px solid var(--line-strong); border-radius:var(--radius-sm, 4px); color:var(--muted); font-size:var(--text-xs); white-space:nowrap; }
.tb-menu .tb-item.is-greyed { color:var(--muted); cursor:not-allowed; }
.tb-menu .tb-item-why { grid-column:1 / -1; color:var(--muted); font-size:var(--text-sm); white-space:normal; }
.tb-menu-empty { margin:0; padding:var(--space-100) var(--space-200); color:var(--muted); }

/* ---------- Marked as spam ---------- */
.tb-spam-banner { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:var(--space-100) var(--space-200); margin:0 0 var(--space-150); padding:var(--space-150) var(--space-200); border:1px solid color-mix(in srgb, var(--bad) 35%, var(--line)); border-radius:var(--radius-xl); background:var(--bad-soft); color:var(--ink); }
.tb-spam-banner[hidden] { display:none; }
.tb-spam-banner p { flex:1 1 18rem; min-width:0; margin:0; overflow-wrap:anywhere; }
.tb-spam-blocked { color:var(--ink-2); }
.tb-spam-banner .is-greyed { opacity:.55; cursor:not-allowed; }
.tb-spam-banner .is-greyed:focus-visible { opacity:1; }
.tb-spam-facts { display:grid; gap:var(--space-50); margin:var(--space-100) 0; }
.tb-spam-facts > div { display:grid; grid-template-columns:5rem 1fr; gap:var(--space-100); }
.tb-spam-facts dt { color:var(--muted); }
.tb-spam-facts dd { margin:0; overflow-wrap:anywhere; }
.tb-dialog-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:var(--space-100); margin-top:var(--space-200); }

/* ---------- Ctrl+K: the ticket's actions first ---------- */
.tb-search-heading { margin:var(--space-100) var(--space-150) var(--space-50); color:var(--muted); font-size:var(--text-xs); font-weight:var(--weight-semibold); text-transform:uppercase; }
.tb-search-result kbd { font-size:var(--text-xs); }
.tb-search-result.is-greyed b { color:var(--muted); }

/* ---------- The settings page's list and preview ---------- */
.tt-list { display:grid; gap:var(--space-75); margin:var(--space-150) 0; padding:0; list-style:none; }
.tt-row { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-100); padding:var(--space-100) var(--space-150); border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface); }
.tt-row-name { flex:1 1 10rem; min-width:0; font-weight:var(--weight-semibold); overflow-wrap:anywhere; }
.tt-row-number { color:var(--muted); font-variant-numeric:tabular-nums; }
.tt-row-tools { display:flex; flex-wrap:wrap; gap:var(--space-50); }
.tt-empty { color:var(--muted); }
.tt-add { display:flex; flex-wrap:wrap; align-items:end; gap:var(--space-100); }
.tt-add label { flex:1 1 14rem; }
.tt-notes { margin:var(--space-150) 0 0; padding-left:var(--space-250); color:var(--ink-2); }
.tt-preview { margin-top:var(--space-150); padding:var(--space-150); border:1px dashed var(--line-strong); border-radius:var(--radius-xl); background:var(--paper); overflow:hidden; }
.tt-preview .tb-bar { flex-wrap:wrap; }
.tt-preview-more { margin-top:var(--space-150); }
.tt-preview-more .tb-menu { position:static; width:auto; max-width:24rem; max-height:none; box-shadow:none; }
.tt-preview-more .tb-preview-list { margin:0; padding:0; list-style:none; }
.tt-preview-more .tb-item { cursor:default; }
.tt-preview-tools { margin-top:var(--space-150); }

@media (max-width:600px) {
  .tp > .detail-header.tb-header > .detail-actions { flex-wrap:wrap; }
  .tp > .detail-header.tb-header .detail-save-status { flex-basis:100%; justify-content:flex-start; }
}
/* A phone (the ticket page's phone width, ticket-phone-rules.js PHONE_WIDTH) or a touch screen: 44 px targets. */
@media (max-width:700px), (pointer:coarse) {
  .tb-bar .tb-button, .tb-bar .tb-more { min-height:44px; }
  .tb-menu .tb-item { min-height:44px; }
}

/* Remote help (GitHub issue 511; remote-help.js): the running session's line above the description, and Start's dialog. */
.rh-banner { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:var(--space-100) var(--space-200); margin:0 0 var(--space-150); padding:var(--space-150) var(--space-200); border:1px solid color-mix(in srgb, var(--good) 35%, var(--line)); border-radius:var(--radius-xl); background:var(--good-soft); color:var(--ink); }
.rh-banner[hidden] { display:none; }
.rh-banner p { flex:1 1 18rem; min-width:0; margin:0; overflow-wrap:anywhere; }
.rh-banner small { display:block; color:var(--muted); }
.rh-banner .rh-banner-facts { color:var(--muted); }
.rh-modal .rh-channels { display:grid; gap:var(--space-100); margin:var(--space-150) 0; padding:0; border:0; min-width:0; }
.rh-modal .rh-channels legend { padding:0; margin-bottom:var(--space-100); font-weight:600; }
.rh-modal .rh-channel { display:flex; align-items:flex-start; gap:var(--space-100); min-height:44px; margin:0; font-weight:400; color:var(--ink); }
.rh-modal .rh-channel input { display:inline-block; width:auto; margin:var(--space-25) 0 0; padding:0; flex:none; }
.rh-modal .rh-channel span { display:grid; min-width:0; overflow-wrap:anywhere; }
.rh-modal .rh-channel small { color:var(--muted); }
.rh-modal .rh-channel.is-off { color:var(--muted); }
.rh-modal .rh-preview { margin:var(--space-100) 0; }
.rh-modal .rh-preview-text { white-space:pre-wrap; overflow-wrap:anywhere; max-height:14rem; overflow:auto; padding:var(--space-100) var(--space-150); border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface-2); }
.rh-adapter { margin-top:var(--space-200); }
