/* Admin support workspace. Queue / conversation / inspector; no customer-portal rules.
 * Loaded after the legacy ticket styles. Theme colours come from admin-theme.css.
 * Compact breakpoint matches the DOM adapter (1200px). */
body.atw-active { overflow: hidden; }
body.atw-active #app .admin-content { padding-bottom: 0; }
body.atw-active .admin-footer { display: none; }
body.atw-active #app .admin-hero { min-height: 0; margin: 0; padding-block: 0 14px; }
body.atw-active #app .admin-hero h1 { margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: -.035em; }
body.atw-active #app .admin-hero :is(.eyebrow,p), body.atw-active #app #ticket-new-alert { display: none; }
body.atw-active #app .ticket-notice { margin-bottom: 8px; padding: 8px 12px; }

/* Frame and shared controls. Two IDs intentionally outrank legacy module skins. */
#app #overview-tickets.atw-workspace {
  --atw-line: var(--admin-border, #dfe5ed);
  --atw-ink: var(--admin-text, #29374b);
  --atw-muted: var(--admin-muted, #53637a);
  --atw-surface: var(--admin-surface, #fff);
  --atw-subtle: var(--admin-subtle, #f7f9fc);
  --atw-hover: var(--admin-hover, #eef2f7);
  height: var(--atw-height, calc(100dvh - 190px)); min-height: 0;
  color: var(--atw-ink); font-size: 13px; line-height: 1.5;
}
#app #overview-tickets.atw-workspace :is(button,input,select,textarea) { font-family: inherit; box-sizing: border-box; }
#app #overview-tickets.atw-workspace button:not(.ticket-row) {
  min-height: 36px; padding: 7px 11px; border: 1px solid var(--atw-line); border-radius: 7px;
  background: var(--atw-surface); color: var(--atw-ink); box-shadow: none;
  font-size: 12px; font-weight: 550; line-height: 1.4; cursor: pointer;
}
#app #overview-tickets.atw-workspace button:not(.ticket-row):hover:not(:disabled) { background: var(--atw-hover); }
#app #overview-tickets.atw-workspace button:disabled { opacity: .5; cursor: not-allowed; }
#app #overview-tickets.atw-workspace :is(input,select,textarea) {
  min-width: 0; width: 100%; min-height: 38px; margin: 0; padding: 8px 10px;
  border: 1px solid var(--atw-line); border-radius: 7px; box-shadow: none;
  background: var(--atw-surface); color: var(--atw-ink); font-size: 13px; line-height: 1.4;
}
#app #overview-tickets.atw-workspace :is(input,textarea)::placeholder { color: var(--atw-muted); opacity: 1; }
#app #overview-tickets.atw-workspace :is(button,input,select,textarea,summary,a,[tabindex]):focus-visible { outline: 2px solid var(--admin-accent, #285dde); outline-offset: 2px; }
#app #overview-tickets.atw-workspace .service-desk {
  display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden;
  border: 1px solid var(--atw-line); border-radius: 12px; background: var(--atw-surface); box-shadow: none;
}
#app #overview-tickets.atw-workspace .service-desk-head,
#app #overview-tickets.atw-workspace .atw-area-nav { display: none; }
#app #overview-tickets.atw-workspace .service-desk-grid {
  display: grid; grid-template-columns: clamp(250px, 24%, 280px) minmax(640px, 1fr);
  grid-template-rows: minmax(0, 1fr); align-items: stretch; flex: 1; gap: 0; padding: 0;
  height: auto; min-height: 0; border: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
}

/* Queue: one search, three frequent views, optional filters, independently scrolling list. */
#app #overview-tickets.atw-workspace .atw-inbox { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--atw-subtle); }
#app #overview-tickets.atw-workspace .atw-inbox-head { display: flex; align-items: center; gap: 6px; flex: none; padding: 16px 14px 12px; }
#app #overview-tickets.atw-workspace .atw-inbox-head h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
#app #overview-tickets.atw-workspace #open-ticket-create { padding-inline: 10px; white-space: nowrap; }
#app #overview-tickets.atw-workspace #open-ticket-create svg { display: none; }
#app #overview-tickets.atw-workspace #refresh-tickets { display: inline-flex; justify-content: center; align-items: center; width: 36px; min-width: 36px; padding: 8px; font-size: 0; }
#app #overview-tickets.atw-workspace #refresh-tickets svg { width: 17px; height: 17px; }
#app #overview-tickets.atw-workspace .atw-search { display: grid; gap: 6px; flex: none; min-width: 0; margin: 0; padding: 0 14px 12px; border: 0; border-radius: 0; background: transparent; color: var(--atw-muted); font-size: 12px; }
#app #overview-tickets.atw-workspace .atw-search > svg { display: none; }
#app #overview-tickets.atw-workspace .atw-search input { height: 40px; }
#app #overview-tickets.atw-workspace .atw-queue-views { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 3px; flex: none; margin: 0 14px 10px; padding: 3px; border: 1px solid var(--atw-line); border-radius: 9px; }
#app #overview-tickets.atw-workspace .atw-queue-views button { min-width: 0; padding: 7px 3px; border-color: transparent; background: transparent; color: var(--atw-muted); font-size: 11px; overflow-wrap: anywhere; }
#app #overview-tickets.atw-workspace .atw-queue-views button[aria-pressed="true"] { border-color: var(--atw-line); background: var(--atw-surface); color: var(--atw-ink); }
#app #overview-tickets.atw-workspace .atw-filter-panel { flex: 0 1 auto; min-height: 0; max-height: 42%; overflow: auto; margin: 0; padding: 0 14px; border: 0; border-radius: 0; background: transparent; }
#app #overview-tickets.atw-workspace .atw-filter-panel > summary { padding: 8px 0 12px; cursor: pointer; color: var(--atw-muted); font-size: 12px; font-weight: 550; }
#app #overview-tickets.atw-workspace .ticket-toolbar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 10px; margin: 0; padding: 0 0 14px; border: 0; }
#app #overview-tickets.atw-workspace .ticket-toolbar label { display: grid; grid-column: auto; grid-row: auto; gap: 5px; min-width: 0; min-height: 0; width: auto; margin: 0; padding: 0; border: 0; background: transparent; font-size: 11px; color: var(--atw-muted); }
#app #overview-tickets.atw-workspace .ticket-toolbar select { height: 38px; padding-inline: 7px; font-size: 12px; }
#app #overview-tickets.atw-workspace .desk-list-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; flex: none; padding: 10px 14px; margin: 0; border-block: 1px solid var(--atw-line); color: var(--atw-muted); font-size: 11px; }
#app #overview-tickets.atw-workspace #ticket-risk-summary { margin: 0; }
#app #overview-tickets.atw-workspace #ticket-list { position: static; top: auto; flex: 1; height: auto; min-height: 0; max-height: none; min-width: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; border: 0; border-radius: 0; background: var(--atw-surface); }
#app #overview-tickets.atw-workspace .ticket-row { display: grid; grid-template-columns: 3px minmax(0,1fr); gap: 7px 10px; width: 100%; padding: 15px 13px; border: 0; border-left: 3px solid transparent; border-bottom: 1px solid var(--atw-line); border-radius: 0; background: transparent; color: var(--atw-ink); text-align: left; box-shadow: none; cursor: pointer; }
#app #overview-tickets.atw-workspace .ticket-row:hover { background: var(--atw-hover); }
#app #overview-tickets.atw-workspace .ticket-row.is-unread:not(.is-selected) { background: var(--atw-subtle); }
#app #overview-tickets.atw-workspace .ticket-row.is-selected { border-left-color: var(--admin-accent, #285dde); background: var(--admin-selected, #edf3ff); }
#app #overview-tickets.atw-workspace .ticket-row-main { display: grid; gap: 5px; min-width: 0; }
#app #overview-tickets.atw-workspace .ticket-row-main > strong { font-size: 13px; font-weight: 600; line-height: 1.5; overflow: hidden; overflow-wrap: anywhere; }
#app #overview-tickets.atw-workspace .ticket-row-main > :is(small,span) { font-size: 11px; line-height: 1.5; color: var(--atw-muted); overflow-wrap: anywhere; }
#app #overview-tickets.atw-workspace .ticket-row-meta { grid-column: 2; display: flex; flex-direction: row; align-items: center; justify-content: start; flex-wrap: wrap; gap: 5px 8px; font-size: 11px; }
#app #overview-tickets.atw-workspace :is(.ticket-row-meta small,.atw-priority-label) { font-size: 10px; color: var(--atw-muted); }
#app #overview-tickets.atw-workspace .ticket-status { padding: 3px 7px; border-radius: 5px; background: var(--atw-subtle); color: var(--atw-muted); font-size: 10px; font-style: normal; }
#app #overview-tickets.atw-workspace .ticket-status:is(.is-resolved,.is-closed) { background: var(--admin-success-bg, #edf7f0); color: var(--admin-success, #286142); }
#app #overview-tickets.atw-workspace .ticket-status.is-waiting { background: var(--admin-warning-bg, #fff7e8); color: var(--admin-warning, #79531d); }
#app #overview-tickets.atw-workspace .ticket-unread-mark { margin-left: 6px; padding: 2px 4px; border-radius: 3px; background: var(--admin-selected, #edf3ff); color: var(--admin-accent, #285dde); font-size: 9px; }
#app #overview-tickets.atw-workspace .atw-filter-empty { padding: 32px 18px; gap: 12px; }

/* Conversation: the history gets the remaining space, composer stays within the viewport. */
#app #overview-tickets.atw-workspace #ticket-detail { display: flex; flex-direction: column; height: 100%; min-width: 0; min-height: 0; padding: 0; overflow: auto; border: 0; border-left: 1px solid var(--atw-line); border-radius: 0; background: var(--atw-surface); }
#app #overview-tickets.atw-workspace #ticket-detail.atw-has-ticket { display: grid; grid-template-columns: minmax(0,1fr) 300px; grid-template-rows: auto auto minmax(100px,1fr) auto; overflow: hidden; }
#app #overview-tickets.atw-workspace .tk-detail-head { grid-column: 1; grid-row: 1; min-width: 0; max-height: 140px; overflow: auto; padding: 18px 22px 14px; border-bottom: 1px solid var(--atw-line); background: var(--atw-surface); }
#app #overview-tickets.atw-workspace .tk-detail-head h3 { margin: 10px 0 0; font-size: 21px; font-weight: 600; line-height: 1.35; letter-spacing: -.025em; }
#app #overview-tickets.atw-workspace .atw-ticket-customer { margin: 7px 0 0; color: var(--atw-muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
#app #overview-tickets.atw-workspace .atw-header-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
#app #overview-tickets.atw-workspace .atw-header-actions > div { display: flex; align-items: center; justify-content: space-between; flex: 1; gap: 10px; }
#app #overview-tickets.atw-workspace #ticket-back { display: none; }
#app #overview-tickets.atw-workspace .tk-detail-actions:empty { display: none; }
#app #overview-tickets.atw-workspace .tk-thread-heading { grid-column: 1; grid-row: 2; display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 11px 22px; background: var(--atw-surface); color: var(--atw-muted); font-size: 12px; }
#app #overview-tickets.atw-workspace .tk-thread-heading span { color: var(--atw-muted); }
#app #overview-tickets.atw-workspace .atw-discussion { grid-column: 1; grid-row: 3; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; background: var(--atw-surface); }
#app #overview-tickets.atw-workspace .tk-conversation { display: flex; flex-direction: column; min-height: 0; max-height: none; overflow: visible; gap: 24px; padding: 10px 22px 24px; background: transparent; }
#app #overview-tickets.atw-workspace .tk-message { width: 100%; max-width: 100%; min-width: 0; align-self: stretch; }
#app #overview-tickets.atw-workspace .tk-message-meta { gap: 8px; margin-bottom: 8px; font-size: 12px; color: var(--atw-muted); }
#app #overview-tickets.atw-workspace .tk-message-meta time { font-size: 11px; color: var(--atw-muted); }
#app #overview-tickets.atw-workspace .tk-avatar { border-radius: 50%; background: var(--atw-subtle); color: var(--atw-muted); }
#app #overview-tickets.atw-workspace .tk-message-body { padding: 14px 16px; border: 1px solid var(--atw-line); border-radius: 9px; background: var(--atw-subtle); color: var(--atw-ink); font-size: 13px; line-height: 1.75; }
#app #overview-tickets.atw-workspace .tk-own .tk-message-body { background: var(--atw-surface); border-radius: 9px; }
#app #overview-tickets.atw-workspace .tk-internal .tk-message-body { background: var(--admin-warning-bg, #fff7e8); border: 1px dashed var(--admin-warning-border, #d9be91); color: var(--atw-ink); }
#app #overview-tickets.atw-workspace :is(.tk-internal>small,.tk-note-label) { color: var(--admin-warning, #79531d); }
#app #overview-tickets.atw-workspace .tk-note-label { background: var(--admin-warning-bg, #fff7e8); }
#app #overview-tickets.atw-workspace :is(.ticket-attachments,.tk-attachments) { min-width: 0; padding: 12px 22px; overflow-wrap: anywhere; }

/* Inspector: fixed heading/tabs, one scrolling tab panel; hidden is enforced below. */
#app #overview-tickets.atw-workspace .atw-inspector { grid-column: 2; grid-row: 1 / -1; display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; padding: 18px 16px; overflow: hidden; border-left: 1px solid var(--atw-line); background: var(--atw-subtle); }
#app #overview-tickets.atw-workspace .atw-inspector > h2 { flex: none; margin: 0; font-size: 15px; font-weight: 650; line-height: 1.4; letter-spacing: -.015em; }
#app #overview-tickets.atw-workspace .atw-inspector-nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; flex: none; padding-bottom: 12px; border-bottom: 1px solid var(--atw-line); }
#app #overview-tickets.atw-workspace .atw-inspector-nav button { min-width: 0; padding-inline: 5px; border-color: transparent; background: transparent; color: var(--atw-muted); font-size: 12px; }
#app #overview-tickets.atw-workspace .atw-inspector-nav button[aria-selected="true"] { border-color: var(--atw-line); background: var(--atw-surface); color: var(--atw-ink); }
#app #overview-tickets.atw-workspace :is(.atw-management-panel,.atw-context-panel) { flex: 1; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 2px; }
#app #overview-tickets.atw-workspace .atw-management-panel > * + * { margin-top: 16px; }
#app #overview-tickets.atw-workspace .atw-metadata { margin: 0; border: 0; border-radius: 0; background: transparent; }
#app #overview-tickets.atw-workspace .atw-metadata > summary { display: none; }
#app #overview-tickets.atw-workspace .tk-manage { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 10px; padding: 0; border: 0; background: transparent; }
#app #overview-tickets.atw-workspace .tk-manage label { display: grid; min-width: 0; gap: 6px; font-size: 12px; color: var(--atw-muted); }
#app #overview-tickets.atw-workspace .tk-manage :is(.tk-assignee,.tk-manage-actions) { grid-column: 1 / -1; }
#app #overview-tickets.atw-workspace :is(#save-ticket,#ticket-assign-me) { width: 100%; white-space: normal; }
#app #overview-tickets.atw-workspace .atw-ticket-meta { border-top: 1px solid var(--atw-line); padding-top: 12px; font-size: 12px; }
#app #overview-tickets.atw-workspace :is(.atw-ticket-meta,.tk-history) > summary { padding-block: 4px; cursor: pointer; font-weight: 550; }
#app #overview-tickets.atw-workspace .tk-ticket-facts { display: grid; gap: 8px; padding-block: 12px; color: var(--atw-muted); font-size: 12px; overflow-wrap: anywhere; }
#app #overview-tickets.atw-workspace .atw-deadline { float: none; margin: 0; color: var(--atw-muted); font-size: 12px; }
#app #overview-tickets.atw-workspace .tk-history { margin: 0; padding: 12px 0 0; border-top: 1px solid var(--atw-line); color: var(--atw-muted); font-size: 12px; }
#app #overview-tickets.atw-workspace .tk-history ol { margin: 10px 0 0; padding-left: 18px; }
#app #overview-tickets.atw-workspace .tk-history li { padding: 8px 0; border-bottom: 1px solid var(--atw-line); overflow-wrap: anywhere; }
#app #overview-tickets.atw-workspace .tk-history time { margin-top: 3px; color: var(--atw-muted); font-size: 11px; }
#app #overview-tickets.atw-workspace .tk-internal-hint { padding: 10px 12px; border-radius: 7px; font-size: 12px; line-height: 1.6; }

/* Composer: only sending is primary. Templates expand in flow, without covering messages. */
#app #overview-tickets.atw-workspace .tk-composer { grid-column: 1; grid-row: 4; display: flex; flex-direction: column; gap: 9px; min-height: 0; max-height: min(340px,45dvh); padding: 16px 22px; overflow: auto; border-top: 1px solid var(--atw-line); background: var(--atw-subtle); }
#app #overview-tickets.atw-workspace .atw-compose-title { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
#app #overview-tickets.atw-workspace .atw-compose-body { display: grid; gap: 8px; flex: none; }
#app #overview-tickets.atw-workspace .tk-mode-switch { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
#app #overview-tickets.atw-workspace .tk-composer .atw-native-mode { display: none; }
#app #overview-tickets.atw-workspace .atw-reply-modes { display: flex; flex-wrap: wrap; gap: 4px; }
#app #overview-tickets.atw-workspace .atw-reply-modes button { min-height: 32px; padding: 5px 8px; border-color: transparent; background: transparent; color: var(--atw-muted); font-size: 11px; }
#app #overview-tickets.atw-workspace .atw-reply-modes button[aria-pressed="true"] { border-color: var(--atw-line); background: var(--atw-surface); color: var(--atw-ink); }
#app #overview-tickets.atw-workspace .tk-composer label { display: grid; gap: 5px; min-width: 0; color: var(--atw-muted); font-size: 12px; font-weight: 500; }
#app #overview-tickets.atw-workspace #ticket-reply-visibility { margin: 0; font-size: 11px; line-height: 1.5; color: var(--atw-muted); }
#app #overview-tickets.atw-workspace #ticket-comment-form textarea { height: 84px; min-height: 68px; max-height: 160px; padding: 10px 12px; resize: vertical; font-size: 13px; line-height: 1.6; }
#app #overview-tickets.atw-workspace .tk-compose-footer { display: flex; flex-direction: row; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
#app #overview-tickets.atw-workspace .tk-status-after { flex: 1 1 140px; max-width: 240px; }
#app #overview-tickets.atw-workspace .tk-compose-footer > small { flex: 1 1 100px; font-size: 10px; color: var(--atw-muted); }
#app #overview-tickets.atw-workspace #ticket-comment-form button[type="submit"] { min-height: 40px; margin-left: auto; padding-inline: 16px; border-color: #285dde; background: #285dde; color: #fff; }
#app #overview-tickets.atw-workspace #ticket-comment-form button[type="submit"]:hover:not(:disabled) { background: #204fc3; border-color: #204fc3; }
#app #overview-tickets.atw-workspace .tk-composer[data-visibility="internal"] { background: var(--admin-warning-bg, #fff7e8); border-top-color: var(--admin-warning-border, #d9be91); }
#app #overview-tickets.atw-workspace .tk-composer[data-visibility="internal"] #ticket-reply-visibility { color: var(--admin-warning, #79531d); }
#app #overview-tickets.atw-workspace .atw-templates { position: static; margin: 0; border: 0; font-size: 11px; color: var(--atw-muted); }
#app #overview-tickets.atw-workspace .atw-templates summary { padding: 7px 0; cursor: pointer; }
#app #overview-tickets.atw-workspace .tk-shortcuts { position: static; display: flex; flex-wrap: wrap; gap: 6px; margin-block: 6px; }
#app #overview-tickets.atw-workspace .tk-shortcuts button { min-height: 32px; font-size: 11px; }
#app #overview-tickets.atw-workspace .tk-readonly { grid-column: 1; grid-row: 4; padding: 16px 22px; border-top: 1px solid var(--atw-line); background: var(--atw-subtle); color: var(--atw-muted); font-size: 12px; }
#app #overview-tickets.atw-workspace output:empty { display: none; }
#app #overview-tickets.atw-workspace output:not(:empty) { display: block; margin: 0; padding: 8px 0; color: var(--atw-ink); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
#app #overview-tickets.atw-workspace :is(.tk-error,output.error,output[role="alert"]) { color: var(--admin-danger, #a4322d); }

@media (min-width: 1201px) and (max-height: 820px) {
  body.atw-active #app .admin-content { padding-top: 14px; }
  body.atw-active #app .admin-hero { padding-bottom: 10px; }
  #app #overview-tickets.atw-workspace .tk-composer { padding-block: 10px; }
}

/* Compact screens: keep every area reachable without horizontal scrolling. */
@media (max-width: 1200px) {
  body.atw-active #app .admin-content { padding: 10px 8px 0; }
  body.atw-active #app .admin-hero { padding-bottom: 10px; }
  body.atw-active #app .admin-hero h1 { font-size: 22px; }
  body.atw-mobile-detail #app .admin-hero { display: none; }
  #app #overview-tickets.atw-workspace .service-desk { border-radius: 9px; }
  #app #overview-tickets.atw-workspace .atw-area-nav { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3px; flex: none; padding: 6px; border-bottom: 1px solid var(--atw-line); }
  #app #overview-tickets.atw-workspace .atw-area-nav button { min-width: 0; min-height: 44px; padding: 6px 3px; border-color: transparent; background: transparent; color: var(--atw-muted); font-size: 11px; }
  #app #overview-tickets.atw-workspace .atw-area-nav button[aria-pressed="true"] { border-color: var(--atw-line); background: var(--atw-subtle); color: var(--atw-ink); }
  #app #overview-tickets.atw-workspace .service-desk-grid { grid-template-columns: minmax(0,1fr); overflow: hidden; }
  #app #overview-tickets.atw-workspace.tk-show-detail .atw-inbox,
  #app #overview-tickets.atw-workspace:not(.tk-show-detail) #ticket-detail { display: none; }
  #app #overview-tickets.atw-workspace #ticket-detail.atw-has-ticket { grid-template-columns: minmax(0,1fr); border: 0; }
  #app #overview-tickets.atw-workspace .atw-inspector { display: none; }
  #app #overview-tickets.atw-workspace[data-atw-pane="details"] #ticket-detail.atw-has-ticket { display: flex; }
  #app #overview-tickets.atw-workspace[data-atw-pane="details"] #ticket-detail.atw-has-ticket > :not(.atw-inspector) { display: none; }
  #app #overview-tickets.atw-workspace[data-atw-pane="details"] .atw-inspector { display: flex; flex: 1; border: 0; padding: 16px; }
  #app #overview-tickets.atw-workspace :is(input,select,textarea) { min-height: 44px; font-size: 16px; }
  #app #overview-tickets.atw-workspace :is(.ticket-toolbar select,.atw-search input) { height: 44px; font-size: 16px; }
  #app #overview-tickets.atw-workspace :is(.atw-inbox-head button,.atw-queue-views button,.atw-inspector-nav button,.atw-reply-modes button,#save-ticket,#ticket-assign-me) { min-height: 44px; }
  #app #overview-tickets.atw-workspace #refresh-tickets { width: 44px; min-width: 44px; }
  #app #overview-tickets.atw-workspace .atw-filter-panel > summary { padding-block: 12px; }
  #app #overview-tickets.atw-workspace .ticket-row { padding: 16px 14px; }
  #app #overview-tickets.atw-workspace .tk-detail-head { padding: 12px 14px; max-height: none; }
  #app #overview-tickets.atw-workspace .tk-detail-head h3 { font-size: 18px; }
  #app #overview-tickets.atw-workspace :is(.tk-thread-heading,.tk-conversation) { padding-inline: 14px; }
  #app #overview-tickets.atw-workspace .tk-composer { padding: 10px 14px; max-height: 48dvh; }
  #app #overview-tickets.atw-workspace #ticket-comment-form textarea { height: 80px; font-size: 16px; }
  #app #overview-tickets.atw-workspace .tk-compose-footer > small { flex-basis: 100%; order: 3; }
  #app #overview-tickets.atw-workspace #ticket-comment-form button[type="submit"] { min-height: 44px; max-width: 48%; padding-inline: 10px; white-space: normal; }
}
/* A software keyboard must not make the composer unreachable. Scroll only the detail. */
@media (max-height: 640px) {
  #app #overview-tickets.atw-workspace #ticket-detail.atw-has-ticket { overflow: auto; }
  #app #overview-tickets.atw-workspace .tk-composer { max-height: none; }
}
/* Never turn JS-hidden permissions, inactive panels or filtered rows into visible content. */
#app #overview-tickets.atw-workspace [hidden] { display: none !important; }
body[data-admin-role="viewer"] #app #overview-tickets.atw-workspace :is(.atw-metadata,#ticket-comment-form) { display: none; }

/* Leave readable conversation space while keeping every reply action reachable. */
@media (max-width: 600px) and (min-height: 641px) {
  #app #overview-tickets.atw-workspace .tk-composer { padding: 8px 12px; gap: 6px; max-height: 38dvh; }
  #app #overview-tickets.atw-workspace .atw-compose-body { gap: 5px; }
  #app #overview-tickets.atw-workspace #ticket-comment-form textarea { height: 56px; min-height: 44px; }
  #app #overview-tickets.atw-workspace .tk-compose-footer { gap: 5px 8px; }
}

/* Status and ownership are independent, immediately visible queue controls. */
#app #overview-tickets.atw-workspace #ticket-stats.atw-status-overview{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;flex:none;margin:0;padding:0 12px 10px;background:transparent;border:0}
#app #overview-tickets.atw-workspace #ticket-stats.atw-status-overview>button{display:flex;align-items:center;justify-content:space-between;gap:4px;min-width:0;min-height:38px;padding:7px;border:1px solid var(--atw-line);border-radius:7px;background:var(--atw-surface);color:var(--atw-muted);font-size:10px;text-align:left}
#app #overview-tickets.atw-workspace #ticket-stats.atw-status-overview>button b{color:var(--atw-ink);font-size:14px;font-weight:650}
#app #overview-tickets.atw-workspace #ticket-stats.atw-status-overview>button[aria-pressed=true]{background:var(--admin-selected);border-color:var(--admin-accent);color:var(--admin-accent)}
#app #overview-tickets.atw-workspace .atw-inbox-head{padding-top:12px;padding-bottom:10px}
#app #overview-tickets.atw-workspace .atw-search{gap:0;padding-bottom:10px}
#app #overview-tickets.atw-workspace .atw-search>span{display:none}
#app #overview-tickets.atw-workspace .tk-thread-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:7px;padding:10px 18px;border-bottom:1px solid var(--atw-line);background:var(--atw-subtle)}
#app #overview-tickets.atw-workspace .tk-thread-heading>span{font-size:11px;color:var(--atw-muted)}
#app #overview-tickets.atw-workspace .tk-thread-heading>.atw-reply-modes{display:flex;gap:4px;margin:0;padding:3px;border:1px solid var(--atw-line);border-radius:9px;background:var(--atw-surface)}
#app #overview-tickets.atw-workspace .atw-reply-modes button{min-height:34px;padding:7px 10px;border:1px solid transparent;background:transparent;font-size:12px;color:var(--atw-muted)}
#app #overview-tickets.atw-workspace .atw-reply-modes button[aria-pressed=true]{background:var(--admin-selected);border-color:var(--admin-border);color:var(--admin-accent)}
#app #overview-tickets.atw-workspace .atw-reply-modes button[data-atw-visibility=internal][aria-pressed=true]{background:var(--admin-warning-bg);color:var(--admin-warning)}
#app #overview-tickets.atw-workspace .atw-discussion{background:var(--atw-subtle)}
#app #overview-tickets.atw-workspace .atw-discussion .tk-conversation{padding:18px;gap:14px}
#app #overview-tickets.atw-workspace .atw-discussion .tk-message{align-self:flex-start;max-width:88%;width:fit-content;border:1px solid var(--atw-line);border-radius:12px;background:var(--atw-surface)}
#app #overview-tickets.atw-workspace .atw-discussion .tk-message.tk-own{align-self:flex-end;background:var(--admin-selected)}
#app #overview-tickets.atw-workspace .atw-discussion .tk-message.tk-internal{align-self:stretch;max-width:100%;width:auto;background:var(--admin-warning-bg);border-style:dashed}
#app #overview-tickets.atw-workspace .atw-channel-empty{margin:0;color:var(--atw-muted);font-size:13px;text-align:center}
#app #overview-tickets.atw-workspace .atw-compose-title{padding-top:10px}
@media(min-width:1201px){
 #app #overview-tickets.atw-workspace .service-desk-grid{grid-template-columns:340px minmax(0,1fr);overflow:hidden}
 #app #overview-tickets.atw-workspace #ticket-detail.atw-has-ticket{grid-template-columns:minmax(0,1fr) 260px}
}
@media(max-width:640px){
 #app #overview-tickets.atw-workspace .tk-thread-heading{padding:8px 12px}
 #app #overview-tickets.atw-workspace .atw-discussion .tk-conversation{padding:12px}
 #app #overview-tickets.atw-workspace .atw-reply-modes button{padding:6px 8px;font-size:11px}
}

#app #overview-tickets.atw-workspace #ticket-stats>button>span{min-width:0;line-height:1.3;overflow-wrap:normal;white-space:normal}
#app #overview-tickets.atw-workspace #ticket-stats>button>b{flex:none}
#app #overview-tickets.atw-workspace .tk-composer{padding:12px 18px;gap:7px}
#app #overview-tickets.atw-workspace .atw-compose-title{padding-top:0}
#app #overview-tickets.atw-workspace #ticket-reply-visibility{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#app #overview-tickets.atw-workspace .atw-discussion .tk-message{padding:12px 14px}
#app #overview-tickets.atw-workspace .atw-discussion .tk-message-body{padding:0;border:0;border-radius:0;background:transparent}
#app #overview-tickets.atw-workspace .tk-composer .tk-mode-switch:has(.atw-templates[hidden]){display:none}

#app #overview-tickets.atw-workspace .atw-filter-panel>#ticket-mark-seen{width:100%;margin:0 0 10px;font-size:11px}
#app #overview-tickets.atw-workspace #ticket-stats.atw-status-overview>button>b{background:transparent;padding:0;border-radius:0;min-width:0;color:var(--atw-ink)}
