/*
 * Helpdesk — minimal UI (Propshaft serves this file as-is).
 */

:root {
  color-scheme: light dark;
  --bg: #e8e3d6;
  --surface: #ffffff;
  --text: #212121;
  --muted: #828a94;
  --border: #e1e2e4;
  --primary: #123d4d;
  --primary-hover: #524070;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --notice-bg: #e1e2e4;
  --notice-text: #123d4d;
  --message-well-bg: #e1e2e4;
  --bg-subtle: #e1e2e4;
  --on-primary: #ffffff;
  --badge-open-bg: #9ebacf;
  --badge-open-text: #123d4d;
  --badge-in-progress-bg: #e8e3d6;
  --badge-in-progress-text: #524070;
  --badge-resolved-bg: #e1e2e4;
  --badge-resolved-text: #123d4d;
  --badge-closed-bg: #e1e2e4;
  --badge-closed-text: #524070;
  --badge-priority-urgent-bg: var(--danger-bg);
  --badge-priority-urgent-text: var(--danger-text);
  --badge-priority-high-bg: #bf47b0;
  --badge-priority-high-text: #212121;
  --badge-priority-medium-bg: #5996c9;
  --badge-priority-medium-text: #123d4d;
  --badge-priority-low-bg: #e1e2e4;
  --badge-priority-low-text: #524070;
  --badge-solution-bg: #dcfce7;
  --badge-solution-text: #166534;
  /* Drawer width tiers. See .cursor/skills/table-edit-drawer-pattern. */
  --drawer-width-small: 46vw;
  --drawer-width-medium: 56vw;
  --drawer-width-large: 66vw;
}

@media (max-width: 1100px) {
  :root { --drawer-width-large: 100vw; }
}

@media (max-width: 1000px) {
  :root { --drawer-width-medium: 100vw; }
}

@media (max-width: 900px) {
  :root { --drawer-width-small: 100vw; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #212121;
    --surface: #2b2b2b;
    --text: #ffffff;
    --muted: #9ebacf;
    --border: #524070;
    --primary: #9ebacf;
    --primary-hover: #5996c9;
    --danger-bg: #3f1d1d;
    --danger-text: #fecaca;
    --notice-bg: #123d4d;
    --notice-text: #ffffff;
    --message-well-bg: #2b2b2b;
    --bg-subtle: #524070;
    --on-primary: #212121;
    --badge-open-bg: #123d4d;
    --badge-open-text: #ffffff;
    --badge-in-progress-bg: #524070;
    --badge-in-progress-text: #ffffff;
    --badge-resolved-bg: #5996c9;
    --badge-resolved-text: #212121;
    --badge-closed-bg: #828a94;
    --badge-closed-text: #212121;
    --badge-priority-urgent-bg: #450a0a;
    --badge-priority-urgent-text: #fecaca;
    --badge-priority-high-bg: #bf47b0;
    --badge-priority-high-text: #212121;
    --badge-priority-medium-bg: #9ebacf;
    --badge-priority-medium-text: #212121;
    --badge-priority-low-bg: #524070;
    --badge-priority-low-text: #e1e2e4;
    --badge-solution-bg: #14532d;
    --badge-solution-text: #dcfce7;
  }
}

/* User preference: force light palette (overrides prefers-color-scheme). */
html[data-user-theme="light"] {
  color-scheme: light;
  --bg: #e8e3d6;
  --surface: #ffffff;
  --text: #212121;
  --muted: #828a94;
  --border: #e1e2e4;
  --primary: #123d4d;
  --primary-hover: #524070;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --notice-bg: #e1e2e4;
  --notice-text: #123d4d;
  --message-well-bg: #e1e2e4;
  --bg-subtle: #e1e2e4;
  --on-primary: #ffffff;
  --badge-open-bg: #9ebacf;
  --badge-open-text: #123d4d;
  --badge-in-progress-bg: #e8e3d6;
  --badge-in-progress-text: #524070;
  --badge-resolved-bg: #e1e2e4;
  --badge-resolved-text: #123d4d;
  --badge-closed-bg: #e1e2e4;
  --badge-closed-text: #524070;
  --badge-priority-urgent-bg: var(--danger-bg);
  --badge-priority-urgent-text: var(--danger-text);
  --badge-priority-high-bg: #bf47b0;
  --badge-priority-high-text: #212121;
  --badge-priority-medium-bg: #5996c9;
  --badge-priority-medium-text: #123d4d;
  --badge-priority-low-bg: #e1e2e4;
  --badge-priority-low-text: #524070;
  --badge-solution-bg: #dcfce7;
  --badge-solution-text: #166534;
}

html[data-user-theme="light"] .app-header__logo-wrap {
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--primary);
}

/* User preference: force dark palette. */
html[data-user-theme="dark"] {
  color-scheme: dark;
  --bg: #212121;
  --surface: #2b2b2b;
  --text: #ffffff;
  --muted: #9ebacf;
  --border: #524070;
  --primary: #9ebacf;
  --primary-hover: #5996c9;
  --danger-bg: #3f1d1d;
  --danger-text: #fecaca;
  --notice-bg: #123d4d;
  --notice-text: #ffffff;
  --message-well-bg: #2b2b2b;
  --bg-subtle: #524070;
  --on-primary: #212121;
  --badge-open-bg: #123d4d;
  --badge-open-text: #ffffff;
  --badge-in-progress-bg: #524070;
  --badge-in-progress-text: #ffffff;
  --badge-resolved-bg: #5996c9;
  --badge-resolved-text: #212121;
  --badge-closed-bg: #828a94;
  --badge-closed-text: #212121;
  --badge-priority-urgent-bg: #450a0a;
  --badge-priority-urgent-text: #fecaca;
  --badge-priority-high-bg: #bf47b0;
  --badge-priority-high-text: #212121;
  --badge-priority-medium-bg: #9ebacf;
  --badge-priority-medium-text: #212121;
  --badge-priority-low-bg: #524070;
  --badge-priority-low-text: #e1e2e4;
  --badge-solution-bg: #14532d;
  --badge-solution-text: #dcfce7;
}

html[data-user-theme="dark"] .app-header__logo-wrap {
  padding: 0;
  background: transparent;
}

/* User preference: force a brand background color in any mode. */
html[data-user-theme-color="steelblue"] {
  --bg: #123d4d;
}

html[data-user-theme-color="azure"] {
  --bg: #5996c9;
}

html[data-user-theme-color="sky"] {
  --bg: #9ebacf;
}

html[data-user-theme-color="magenta"] {
  --bg: #bf47b0;
}

html[data-user-theme-color="plum"] {
  --bg: #524070;
}

html[data-user-theme-color="dune"] {
  --bg: #e8e3d6;
}

html[data-user-theme-color="slate"] {
  --bg: #828a94;
}

html[data-user-theme-color="slate25"] {
  --bg: #e1e2e4;
}

html[data-user-theme-color="porcelain"] {
  --bg: #ffffff;
}

html[data-user-theme-color="obsidian"] {
  --bg: #212121;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10px;
}

body:not(:has(.app-shell)) > .main:has(.auth-card) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Logged-in password change keeps the shell; center the card in the content area. */
.app-shell:has(.auth-card) {
  align-items: stretch;
}

.app-shell:has(.auth-card) .app-shell__body {
  min-height: 100vh;
  min-height: 100dvh;
}

.app-shell__body .main:has(.auth-card) {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
}

.ticket-list-stage {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
}

.ticket-table-scroll {
  width: 100%;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.ticket-table-scroll.ticket-table-scroll--overflowing {
  overflow-x: auto;
}

/* Below the rail (85), so a hover-expanded rail and its logo lie over the
   header the way they lie over the page. */
.app-header {
  position: relative;
  z-index: 84;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem;
  min-height: var(--app-rail-top-inset, 3.6875rem);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-header__zone {
  display: flex;
  align-items: center;
  min-width: 0;
}

.app-header__zone--left {
  grid-column: 1;
  justify-content: flex-start;
}

/* Flexible column: holds the workspace picker, New..., and the search input. */
.app-header__zone--workspace {
  grid-column: 2;
  justify-content: flex-start;
  justify-self: stretch;
  min-width: 0;
}

.app-header__workspace-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
}

.app-header__zone--right {
  grid-column: 3;
  justify-content: flex-end;
  justify-self: end;
  gap: 1rem;
  min-width: 0;
}

/* The logo lives in the rail, so the header has no left zone; drop its
   column, or the empty track's gap pushes the workspace off the content edge. */
.app-header--no-leading {
  grid-template-columns: minmax(0, 1fr) auto;
}

.app-header--no-leading .app-header__zone--workspace {
  grid-column: 1;
}

.app-header--no-leading .app-header__zone--right {
  grid-column: 2;
}

.app-header__leading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.app-header__logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--primary);
}

@media (prefers-color-scheme: dark) {
  .app-header__logo-wrap {
    padding: 0;
    background: transparent;
  }
}

.app-header__logo {
  height: 28px;
  width: auto;
  display: block;
}

.app-header__workspace {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  margin-left: 0;
}

.app-header__workspace-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  flex: 0 0 auto;
}

.app-header__workspace--single .app-header__workspace-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(20rem, 50vw);
}

.app-header-workspace-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.app-header-workspace-form__label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.app-header-workspace-form__label-text {
  font-weight: 500;
}

.app-header-workspace-form__select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 0.35rem 1.6rem 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  background-size: 0.6rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%23828a94' d='M0 0l5 6 5-6z'/></svg>");
  color: var(--text);
  min-width: 13rem;
  max-width: min(22rem, 100%);
  cursor: pointer;
}

.app-header-workspace-form__select::-ms-expand {
  display: none;
}

.app-header-workspace-form__select:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--text));
}

.app-header-workspace-form__select:focus-visible {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 1px;
}

@media (prefers-color-scheme: dark) {
  .app-header-workspace-form__select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%239ebacf' d='M0 0l5 6 5-6z'/></svg>");
  }
}

html[data-user-theme="light"] .app-header-workspace-form__select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%23828a94' d='M0 0l5 6 5-6z'/></svg>");
}

html[data-user-theme="dark"] .app-header-workspace-form__select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%239ebacf' d='M0 0l5 6 5-6z'/></svg>");
}

.app-header__account {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.app-header__user {
  color: var(--muted);
  font-size: 0.9rem;
}

.app-header__user--button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  color: inherit;
  cursor: pointer;
  font: inherit;
  border: 0;
  background: transparent;
  border-radius: 50%;
  padding: 0;
  margin: -0.25rem;
}

.app-header__user--button:hover,
.app-header__user--button:focus-visible {
  color: var(--text);
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.app-header__user-text {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Sits immediately left of the account avatar in the right zone, so it shrinks
   with the viewport instead of claiming a fixed slice of the header. */
.app-header__activity {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  height: 1.4em;
  flex: 0 1 auto;
  min-width: 0;
  width: min(26rem, 26vw);
}

.app-header__activity-viewport {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  height: calc(1.4em * 2);
  overflow: hidden;
  width: 100%;
  min-width: 0;
}

.app-header__activity-track {
  display: flex;
  flex-direction: column;
  transform: translateY(0);
}

.app-header__activity-item {
  height: 1.4em;
  line-height: 1.4em;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__activity-item--empty {
  font-style: italic;
  opacity: 0.8;
}

.app-header__activity-feed {
  display: none;
}

/* Global search — header input */

.global-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  /* Room for "Global search..." and a short query; results open in their own
     panel, so the box doesn't need to be wide. */
  max-width: 16rem;
}

/* Matches the workspace picker trigger box model (~31px tall). Extra right
   padding leaves room for the native type=search cancel (X) control. */
.global-search__input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 0.3rem 1.6rem 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
}

.global-search__input[type="search"]::-webkit-search-decoration,
.global-search__input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.global-search__clear {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  z-index: 1;
  display: none;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}

.global-search__input:not(:placeholder-shown) ~ .global-search__clear {
  display: grid;
  place-items: center;
}

.global-search__clear:hover,
.global-search__clear:focus-visible {
  color: var(--text);
  background: var(--bg-subtle);
  outline: none;
}

.global-search__input::placeholder {
  color: var(--muted);
}

.global-search__input:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--text));
}

.global-search__input:focus-visible {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 1px;
}

.global-search__recent {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 20;
  min-width: 100%;
  max-width: 22rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.global-search__recent[hidden] {
  display: none;
}

.global-search__recent-heading {
  margin: 0;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.global-search__recent-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.global-search__recent-item {
  display: block;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.global-search__recent-item:hover,
.global-search__recent-item:focus-visible {
  background: var(--bg-subtle);
  outline: none;
}

/* Separator only when recent searches sit above the examples. */
.global-search__recent-list + .global-search__examples {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.global-search__example {
  display: flex;
  gap: 0.4rem;
  width: 100%;
  padding: 0.35rem 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
  cursor: default;
}

.global-search__example-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.global-search__example-query {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* Table quick search — a table page's toolbar search box
   (shared/_table_quick_search). Reuses the global search box, X and dropdown,
   at the module control size and the page head's shared
   --index-control-width, so it is exactly as wide as the View dropdown on
   every table page. The dropdown under it may be wider (min 16rem) so the
   Searchable fields hints fit on one line. */
.global-search.table-quick-search {
  flex: 0 1 auto;
  width: var(--index-control-width, 12rem);
  max-width: 100%;
}

.table-quick-search .table-quick-search__input {
  height: var(--module-control-height);
  padding: 0.15rem 1.6rem 0.15rem 0.5rem;
  font-size: 0.95rem;
  line-height: 1.15;
}

/* Grows to its widest line (a field plus its hint) instead of wrapping hints
   into a narrow column; the min and max keep it tidy. */
.table-quick-search__dropdown {
  width: max-content;
  min-width: 16rem;
  max-width: 24rem;
}

.table-quick-search__field {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
}

.table-quick-search__field-hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.table-quick-search__note {
  margin: 0.25rem 0 0;
  padding: 0.35rem 0.5rem 0.15rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

/* Global search — floating results panel */

.global-search-panel {
  position: fixed;
  top: 4rem;
  left: 1rem;
  /* Above drawers (90) and elevated drawers (120), below body tooltips. */
  z-index: 130;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: var(--global-search-panel-width, max(50vw, 40rem));
  height: var(--global-search-panel-height, min(70vh, 46rem));
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 5rem);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.global-search-panel[hidden] {
  display: none;
}

.global-search-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.global-search-panel__title {
  margin: 0;
  min-width: 0;
  font-size: 0.875rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-panel__query {
  font-weight: 600;
  color: var(--text);
}

.global-search-panel__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.global-search-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.global-search-panel__close:hover,
.global-search-panel__close:focus-visible {
  background: var(--bg-subtle);
  color: var(--text);
}

.global-search-panel__body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  flex: 1 1 auto;
  padding: 0.85rem;
  overflow-y: auto;
}

.global-search-panel__resizer {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 0;
  background:
    linear-gradient(
      135deg,
      transparent 0 50%,
      var(--border) 50% 60%,
      transparent 60% 75%,
      var(--border) 75% 85%,
      transparent 85%
    );
  cursor: nwse-resize;
}

/* Global search — sections */

.global-search-section__frame {
  display: block;
}

.global-search-section__head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.global-search-section__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.global-search-section__status {
  font-size: 0.75rem;
  color: var(--muted);
}

.global-search-section__empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.global-search-section__more {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
}

.global-search-section__more-link {
  color: var(--primary);
}

.global-search-section__skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.global-search-section__skeleton span {
  display: block;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-subtle);
  opacity: 0.5;
}

/* Global search — result cards (mirrors the dashboard Recently Visited rows) */

.global-search-result__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.global-search-result__item {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.global-search-result__item:hover {
  border-color: var(--primary);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--primary) 20%, transparent);
}

/* Flex rather than grid: only ticket rows carry the leading id column. */
.global-search-result__link {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  color: inherit;
  text-decoration: none;
  font-size: 0.875rem;
}

.global-search-result__id {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.global-search-result__main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1 1 auto;
  min-width: 0;
}

.global-search-result__heading {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-result__detail {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-result__match {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-top: 0.15rem;
  font-size: 0.8125rem;
  color: var(--text);
  overflow: hidden;
}

.global-search-result__match-label {
  font-weight: 600;
  color: var(--muted);
}

.global-search-result__match-label::after {
  content: ": ";
}

.global-search-result__match mark {
  padding: 0 0.1rem;
  border-radius: 3px;
  background: color-mix(in srgb, var(--primary) 32%, var(--surface));
  color: var(--text);
}

.global-search-result__heading mark {
  padding: 0 0.1rem;
  border-radius: 3px;
  background: color-mix(in srgb, var(--primary) 32%, var(--surface));
  color: inherit;
}

.global-search-result__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex: 0 0 auto;
  max-width: 40%;
}

.global-search-result__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.global-search-result__pill--colored {
  background: color-mix(
    in srgb,
    var(--global-search-pill-color, var(--muted)) 22%,
    var(--surface)
  );
  border-color: color-mix(
    in srgb,
    var(--global-search-pill-color, var(--border)) 55%,
    var(--border)
  );
  color: var(--text);
}

.global-search-result__pill--source {
  background: var(--bg-subtle);
  color: var(--text);
}

@media (max-width: 900px) {
  .global-search-panel {
    left: 1rem !important;
    width: calc(100vw - 2rem);
  }
}

/* Global search — full page */

.search-page__form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.search-page__query-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.search-page__query-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 32rem;
}

.search-page__query-wrap .global-search__recent {
  max-width: none;
}

/* Intentionally not compact: this submit sits beside the query field
   and must share its height rather than the 24px toolbar token. */
.search-page__query-row .button {
  height: auto;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.search-page__options {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1.5rem;
  margin: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.search-page__options-legend {
  padding: 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.search-page__option {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-page__option-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.search-page__sort {
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  min-width: 12rem;
  max-width: min(20rem, 100%);
}

/* Sits last in the Modules row, so its label lines up with the module
   checkboxes and its control with the sort selects. */
.search-page__option-label {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
}

.search-workspace-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-workspace-picker__trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  min-width: 12rem;
  max-width: min(20rem, 100%);
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.search-workspace-picker__trigger:hover {
  border-color: var(--muted);
}

.search-workspace-picker__trigger:focus-visible {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 1px;
}

.search-workspace-picker__summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-workspace-picker__caret {
  flex-shrink: 0;
  font-size: 0.65rem;
  opacity: 0.75;
}

.search-workspace-picker__panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 100%;
  max-width: 18rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.search-workspace-picker__panel[hidden] {
  display: none;
}

.search-workspace-picker__list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 13rem;
  overflow-y: auto;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.search-workspace-picker__row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
}

.search-workspace-picker__row:hover {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.search-page__empty {
  margin: 0;
  color: var(--muted);
}

.search-page__results {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (max-width: 1100px) {
  .app-header {
    gap: 0.5rem;
  }

  .app-header-workspace-form__label-text {
    display: none;
  }

  .app-header-workspace-form__select {
    min-width: 10rem;
    max-width: min(14rem, 100%);
  }

  .app-header__activity {
    width: min(18rem, 20vw);
  }
}

@media (max-width: 900px) {
  .app-header {
    gap: 0.5rem;
  }

  .app-header__zone--right {
    gap: 0.75rem;
  }

  /* Too little room for both the ticker and the search input; search wins. */
  .app-header__activity {
    display: none;
  }

  .app-header-workspace-form__select {
    min-width: 8.5rem;
    max-width: min(12rem, 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-header__activity-track {
    transition: none !important;
  }
}

.app-shell {
  --app-rail-top-inset: 3.6875rem;
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
}

.app-shell__body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.app-shell__body .main {
  flex: 1;
  padding-left: calc(3rem + 10px);
  transition: padding-left 0.18s ease;
}

/* The rail owns the top-left corner, so the header starts at its edge and
   its first item lines up with the page content below. */
.app-shell .app-header {
  margin-left: 3rem;
  padding-left: 10px;
  transition: margin-left 0.18s ease;
}

/* A pinned rail keeps its expanded width and the page makes room for it. */
.app-shell--rail-pinned .app-shell__body .main {
  padding-left: calc(var(--app-rail-expanded-width, 16rem) + 10px);
}

.app-shell--rail-pinned .app-header {
  margin-left: var(--app-rail-expanded-width, 16rem);
}

/* Ticket pages keep global search and New... in reach while reading a thread.
   ticket_sticky_head_controller.js publishes this header's height as
   --app-header-offset so the ticket title bar pins directly beneath it. */
.app-shell__body:has(.ticket-show__sticky) > .app-header {
  position: sticky;
  top: 0;
}

/* Live drag of the rail edge: follow the pointer exactly, and keep the drag
   from selecting page text on the way. */
.app-shell--rail-resizing {
  cursor: col-resize;
  user-select: none;
}

.app-shell--rail-resizing .app-rail,
.app-shell--rail-resizing .app-header,
.app-shell--rail-resizing .app-shell__body .main,
.app-shell--rail-resizing .app-rail__logo-link,
.app-shell--rail-resizing .app-rail__link::after {
  transition: none;
}

/* Too narrow to give the page a sliver: pinned lies over it instead. */
@media (max-width: 768px) {
  .app-shell--rail-pinned .app-shell__body .main {
    padding-left: calc(3rem + 10px);
  }

  .app-shell--rail-pinned .app-header {
    margin-left: 3rem;
  }
}

/* Shell without the fixed nav rail (customer portal). The rail is
   position: fixed, so the body reserves its width above; reclaim it. */
.app-shell--no-rail .app-shell__body .main {
  padding-left: 10px;
}

.app-shell--no-rail .app-header {
  margin-left: 0;
  padding-left: 0.75rem;
}

.app-rail {
  /* Side gap on every expanded row; rows that set their own width have to
     subtract both sides of it to line up with the rest. */
  --app-rail-item-inset: 0.5rem;
  position: fixed;
  top: var(--app-rail-top-inset, 3.6875rem);
  left: 0;
  width: 3rem;
  height: calc(100vh - var(--app-rail-top-inset, 3.6875rem));
  height: calc(100dvh - var(--app-rail-top-inset, 3.6875rem));
  max-height: calc(100vh - var(--app-rail-top-inset, 3.6875rem));
  max-height: calc(100dvh - var(--app-rail-top-inset, 3.6875rem));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  padding-left: 0;
  padding-right: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 85;
  overflow: visible;
  min-height: 0;
  transition: width 0.18s ease;
}

/* Fills the band beside the header, so the rail runs to the top of the
   viewport and the logo stays put while the header scrolls away. */
.app-rail__head {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: -1px;
  height: var(--app-rail-top-inset, 3.6875rem);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

/* Collapsed it is the same box as the rail icons below; expanded it spans the
   row so the wide logo starts where the row icons do. */
.app-rail__logo-link {
  position: relative;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  margin-left: 0.125rem;
  overflow: hidden;
  border-radius: 8px;
  background: var(--primary);
  outline-offset: 2px;
  transition: width 0.18s ease, margin-left 0.18s ease;
}

.app-rail--expanded .app-rail__logo-link {
  width: calc(100% - 2 * var(--app-rail-item-inset));
  margin-left: var(--app-rail-item-inset);
}

/* The logo art is white, so it needs the tile on a light surface only. */
@media (prefers-color-scheme: dark) {
  .app-rail__logo-link {
    background: transparent;
  }
}

html[data-user-theme="light"] .app-rail__logo-link {
  background: var(--primary);
}

html[data-user-theme="dark"] .app-rail__logo-link {
  background: transparent;
}

.app-rail__logo {
  position: absolute;
  top: 50%;
  display: block;
  transform: translateY(-50%);
  transition: opacity 0.12s ease;
}

.app-rail__logo--mark {
  left: 0.375rem;
  width: 2rem;
  height: 2rem;
}

.app-rail__logo--wide {
  left: 0.7rem;
  height: 28px;
  width: auto;
  max-width: none;
  opacity: 0;
}

.app-rail--expanded .app-rail__logo--mark {
  opacity: 0;
}

.app-rail--expanded .app-rail__logo--wide {
  opacity: 1;
}

.app-rail--expanded {
  width: var(--app-rail-expanded-width, 16rem);
}

/* Three stacked sections: the menu toggle on top and the settings menus at
   the bottom stay put; only the middle one (modules, bookmarks, groups,
   "+ Group") scrolls when it does not fit. */
.app-rail__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 0;
}

.app-rail__list--fixed + .app-rail__scroller {
  margin-top: 0.25rem;
}

.app-rail__scroller + .app-rail__list--fixed {
  margin-top: 0.25rem;
}

.app-rail__scroller {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

/* No scroll bar: the arrow strips stand in for it (app_rail_scroll_controller).
   Wheel, trackpad and keyboard focus still scroll it. */
.app-rail__list--scroll {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.app-rail__list--scroll::-webkit-scrollbar {
  display: none;
}

/* The section clips its edges, so the focus ring sits inside the row. */
.app-rail__list--scroll > .app-rail__item > .app-rail__link {
  outline-offset: -2px;
}

.app-rail__scroll {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 1rem;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.app-rail--expanded .app-rail__scroll {
  width: calc(100% - 2 * var(--app-rail-item-inset));
}

.app-rail__scroller--overflowing > .app-rail__scroll {
  display: flex;
}

.app-rail__scroll--up {
  margin-bottom: 0.25rem;
}

.app-rail__scroll--down {
  margin-top: 0.25rem;
}

.app-rail__scroll:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

/* Already at that end: greyed out, like the table page arrows. */
.app-rail__scroll--at-end,
.app-rail__scroll--at-end:hover {
  color: var(--muted);
  background: transparent;
  opacity: 0.35;
  cursor: default;
}

.app-rail__link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  outline-offset: 2px;
}

.app-rail__link:hover,
.app-rail__link:focus-visible {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.app-rail__link[aria-current="page"] {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.app-rail__icon {
  flex-shrink: 0;
  display: block;
}

.app-rail__link::after {
  content: attr(data-label);
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.2;
  max-width: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: max-width 0.18s ease, opacity 0.12s ease, margin-left 0.18s ease;
}

.app-rail__item--menu {
  position: relative;
  list-style: none;
}

.app-rail__link--menu-trigger {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.app-rail__link--menu-trigger::after {
  /* participates in the same inline expand animation as other links */
}

.app-rail--expanded .app-rail__link {
  width: auto;
  margin: 0 var(--app-rail-item-inset);
  justify-content: flex-start;
  padding: 0 0.7rem;
}

/* A link fills the row on its own, but a button shrinks to its label, which
   would leave menus and "New menu" with a stubby hover highlight. */
.app-rail--expanded .app-rail__link--menu-trigger,
.app-rail--expanded .app-rail__link--new-menu,
.app-rail--expanded .app-rail__link--pin {
  width: calc(100% - 2 * var(--app-rail-item-inset));
}

/* The link is as wide as the row, so the label shrinks to whatever the rail
   width leaves and clips with an ellipsis past that. */
.app-rail--expanded .app-rail__link::after {
  max-width: var(--app-rail-expanded-width, 16rem);
  opacity: 1;
  margin-left: 0.75rem;
}

/* Set by app_rail_controller when the full label would not fit. */
.app-rail__link[data-label-fit="short"]::after {
  content: attr(data-short-label);
}

.app-rail__link--pin {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.app-rail__link--pin[aria-pressed="true"] {
  color: var(--primary);
}

/* Straddles the rail's right border; only there while the rail is open. */
.app-rail__resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -3px;
  z-index: 1;
  display: none;
  width: 6px;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}

.app-rail--expanded .app-rail__resize-handle {
  display: block;
}

.app-rail__resize-handle::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  background: transparent;
  transition: background-color 0.12s ease;
}

.app-rail__resize-handle:hover::before,
.app-rail__resize-handle:focus-visible::before,
.app-shell--rail-resizing .app-rail__resize-handle::before {
  background: var(--primary);
}

@media (prefers-reduced-motion: reduce) {
  .app-rail {
    transition: none;
  }

  .app-header,
  .app-shell__body .main {
    transition: none;
  }

  .app-rail__logo-link,
  .app-rail__logo {
    transition: none;
  }

  .app-rail__link::after {
    transition: none;
  }
}

.app-rail__flyout {
  /* position/top/left set by rail_management_menu_controller (fixed + viewport clamp) */
  z-index: 90;
  box-sizing: border-box;
  min-width: 15rem;
  max-width: min(22rem, calc(100vw - 2 * 8px));
  padding: 0.5rem 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 14%, transparent);
}

.app-rail__flyout-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-rail__flyout-link {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  color: var(--text);
  outline-offset: 2px;
}

.app-rail__flyout-link:hover,
.app-rail__flyout-link:focus-visible {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.app-rail__flyout-link--inactive {
  color: var(--muted);
}

.app-rail__flyout-link-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.app-rail__flyout-link-label {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.25;
}

.app-rail__flyout-link-desc {
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--muted);
}

.app-rail__flyout-icon {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Rail layout editing: drag an icon to reorder it, or into a menu the user made. */
.app-rail__item {
  list-style: none;
}

/* Grab only on the icon: the rest of the row is a plain link or menu trigger. */
.app-rail__item[data-rail-kind] > .app-rail__link > .app-rail__icon,
.app-rail__flyout-list > [data-rail-kind] > .app-rail__flyout-link > .app-rail__icon {
  cursor: grab;
}

.app-rail--dragging .app-rail__link,
.app-rail--dragging .app-rail__flyout-link,
.app-rail--dragging .app-rail__icon {
  cursor: grabbing;
}

.app-rail--dragging {
  user-select: none;
}

.app-rail__item--dragging {
  opacity: 0.35;
}

.app-rail__item--drop-target > .app-rail__link {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.app-rail__placeholder {
  height: 2.75rem;
  margin: 0 auto;
  width: 2.75rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
}

.app-rail--expanded .app-rail__placeholder {
  width: auto;
  margin: 0 var(--app-rail-item-inset);
}

.app-rail__flyout-placeholder {
  height: 2rem;
  margin: 0 0.75rem;
  border-radius: 6px;
  border: 1px dashed var(--border);
}

.app-rail__drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: -1.125rem 0 0 -1.125rem;
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--text) 22%, transparent);
  pointer-events: none;
}

.app-rail__link--new-menu {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.app-rail--expanded .app-rail__link--new-menu {
  padding: 0 0.7rem;
}

.app-rail__flyout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0.75rem 0.5rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

/* Also the rename control, so it reads as a name until it is clicked. */
.app-rail__flyout-header-name {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  padding: 0.1rem 0.2rem;
  margin: 0 -0.2rem;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: text;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-rail__flyout-header-name:hover,
.app-rail__flyout-header-name:focus-visible {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.app-rail__flyout-header-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.5rem;
}

.app-rail__flyout-header-action {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}

.app-rail__flyout-header-action:hover,
.app-rail__flyout-header-action:focus-visible {
  color: var(--text);
}

.app-rail__flyout-header-action--delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
}

.app-rail__flyout-header-action--delete:hover,
.app-rail__flyout-header-action--delete:focus-visible {
  color: var(--danger-text);
  background: var(--danger-bg);
}

.app-rail__flyout-empty {
  margin: 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Ticket bookmarks: the requester's avatar stands in for a favicon, at the
   same size as the module icons beside it. */
.app-rail__bookmark-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.app-rail__bookmark-avatar.app-rail__flyout-icon,
.app-rail__bookmark-avatar.app-rail__flyout-icon .avatar-badge {
  width: 18px;
  height: 18px;
}

/* Projects issue bookmarks: the issue's type icon (bug, feature, chore, epic)
   in the same 20px box as an avatar. */
.app-rail__bookmark-issue {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.app-rail__bookmark-issue.app-rail__flyout-icon {
  width: 18px;
  height: 18px;
}

.app-rail__item--bookmark {
  position: relative;
}

/* Room for the remove button, so it never sits over the label. */
.app-rail--expanded .app-rail__link--bookmark {
  padding-right: 2rem;
}

.app-rail__link--bookmark::after {
  text-overflow: ellipsis;
}

.app-rail__flyout-bookmark {
  display: flex;
  align-items: center;
  padding-right: 0.5rem;
}

.app-rail__flyout-bookmark > .app-rail__flyout-link {
  flex: 1 1 auto;
  min-width: 0;
}

.app-rail__flyout-link-label--bookmark {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hidden rather than removed, so a menu row keeps its width when it shows. */
.app-rail__bookmark-remove {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  visibility: hidden;
}

.app-rail__bookmark-remove:hover,
.app-rail__bookmark-remove:focus-visible {
  color: var(--danger-text);
  background: var(--danger-bg);
}

.app-rail__item--bookmark > .app-rail__bookmark-remove {
  position: absolute;
  top: 50%;
  right: calc(var(--app-rail-item-inset) + 0.45rem);
  transform: translateY(-50%);
}

.app-rail--expanded .app-rail__item--bookmark:hover > .app-rail__bookmark-remove,
.app-rail--expanded .app-rail__item--bookmark:focus-within > .app-rail__bookmark-remove,
.app-rail__flyout-bookmark:hover > .app-rail__bookmark-remove,
.app-rail__flyout-bookmark:focus-within > .app-rail__bookmark-remove {
  visibility: visible;
}

.app-rail--dragging.app-rail--expanded .app-rail__item--bookmark > .app-rail__bookmark-remove,
.app-rail--dragging .app-rail__flyout-bookmark > .app-rail__bookmark-remove {
  visibility: hidden;
}

/* Naming a menu happens in the rail: the label gives way to this field. */
.app-rail__inline-name {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

/* Author `display` would otherwise win over the browser's [hidden] rule, and
   both the field and the plus button it replaces are toggled that way. */
.app-rail__inline-name[hidden],
.app-rail__link[hidden] {
  display: none;
}

/* No chrome at all: the name simply becomes typable where it sat. The field
   only exists while it holds focus, so the caret is cue enough. */
.app-rail__inline-name-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.1rem 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
}

/* Mirrors the row it stands in for, so the plus and the caret sit exactly
   where the button's icon and label were. */
.app-rail__inline-name--new-menu {
  height: 2.75rem;
  align-items: center;
  gap: 0.75rem;
  margin: 0 var(--app-rail-item-inset);
  padding: 0 0.7rem;
  color: var(--muted);
}

.app-rail__inline-name--new-menu .app-rail__inline-name-input {
  font-weight: 500;
  font-size: 0.85rem;
}

.flash {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.flash-stack {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.flash-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  width: max-content;
  max-width: 31.2vw;
  padding: 0.65rem 0.75rem 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  border-bottom-width: 1px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  animation: flash-toast-slide-down 180ms ease-out;
}

.flash-toast__message {
  overflow-wrap: anywhere;
}

.flash-toast__dismiss {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  line-height: 1;
  font-size: 1rem;
  opacity: 0.75;
}

.flash-toast__dismiss:hover,
.flash-toast__dismiss:focus-visible {
  opacity: 1;
}

@keyframes flash-toast-slide-down {
  from {
    opacity: 0;
    transform: translateY(-0.7rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flash-alert {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.flash-notice {
  background: var(--notice-bg);
  color: var(--notice-text);
}

/* Ticket show: tall wrapper so sticky header has scroll “runway” through the conversation. */
.ticket-show__layout {
  /* Space between the ticket head and the content under it. The head's
     bottom margin and the sidebar's pin point both use it, so the sidebar
     keeps the same gap under the head before and after scrolling. */
  --ticket-show-head-gap: 1.25rem;
  display: block;
  border-radius: 8px;
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.ticket-show__layout--remote-updated {
  animation: ticket-layout-remote-flash 1.2s ease-out;
}

@keyframes ticket-layout-remote-flash {
  0% {
    background-color: color-mix(in srgb, var(--badge-solution-bg) 55%, transparent);
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--badge-solution-text) 35%, transparent);
  }

  100% {
    background-color: transparent;
    box-shadow: inset 0 0 0 0 transparent;
  }
}


/* Main column (70%) + sidebar (30%); sidebar stays in view while the thread
   scrolls. On a ticket the main column holds the details panel and then the
   conversation (.ticket-show__main), so the sidebar starts right under the
   ticket head. */
.ticket-show__conversation-layout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 1rem;
  align-items: start;
}

.ticket-show__main,
.ticket-show__conversation-layout .ticket-thread {
  min-width: 0;
}

/* Pins under the ticket head and is its own scroll container: the wheel scrolls
   the sidebar over it and the thread everywhere else, so the column can run
   taller than the screen without moving while the thread scrolls. */
.ticket-show__sidebar {
  /* Pins the head's gap below the ticket head (--ticket-show-head-gap), the
     same space it has before scrolling. */
  --ticket-sidebar-top: calc(var(--app-header-offset, 0px) + var(--ticket-section-sticky-top, 5.5rem) + var(--ticket-show-head-gap, 0px));
  --ticket-sidebar-view-height: calc(100vh - var(--ticket-sidebar-top) - 1rem);
  position: sticky;
  top: var(--ticket-sidebar-top);
  align-self: start;
  max-height: var(--ticket-sidebar-view-height);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  transition: top 0.15s ease;
}

/* Once the Conversation bar has pinned under the ticket head, the column pins
   level with the bar's bottom edge, where the messages start, rather than the
   head's gap below the head (ticket_sidebar_align_controller.js). */
.ticket-show__sidebar--below-thread-head {
  --ticket-sidebar-top: calc(var(--app-header-offset, 0px) + var(--ticket-section-sticky-top, 5.5rem) + var(--ticket-thread-head-height, 0px));
}

@media (prefers-reduced-motion: reduce) {
  .ticket-show__sidebar {
    transition: none;
  }
}

/* Every panel shows in full (by request, once the sidebar had its own
   column on the ticket page): no height cap, no inner scrollbar, no resize
   handle. A long panel makes the column taller, and the column scrolls on its
   own (above), separately from the details and conversation. The Knowledge
   article page shares this sidebar and behaves the same. */
.ticket-show__sidebar > .ticket-sidebar-panel {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
}

.ticket-show__sidebar .ticket-sidebar-panel__head {
  flex: none;
}

/* The side padding makes both gutters part of the column, so the wheel there
   scrolls the column rather than a panel body or the thread: the strip before
   the scrollbar on the right, and the layout's 1rem column gap on the left
   (the negative margin pulls the column over it without moving the panels). */
.ticket-show__sidebar {
  scrollbar-gutter: stable;
  margin-left: -1rem;
  padding-left: 1rem;
  padding-right: 0.5rem;
}

/* The sidebar column's scrollbar is slightly thinner than the page's. The
   wheel is the primary input, so the thumb only needs to show position. */
.ticket-show__sidebar::-webkit-scrollbar {
  width: 8px;
}

.ticket-show__sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.ticket-show__sidebar::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text) 28%, transparent);
  border-radius: 999px;
}

.ticket-show__sidebar::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text) 45%, transparent);
}

/* Firefox has no width control beyond "thin". */
@supports not selector(::-webkit-scrollbar) {
  .ticket-show__sidebar {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--text) 28%, transparent) transparent;
  }
}

.ticket-sidebar-panel__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.5rem;
}

.ticket-sidebar-panel__title-row .ticket-time-spent__title {
  margin-bottom: 0;
}

.ticket-sidebar-panel {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
}

.ticket-summary__form {
  display: inline;
  margin: 0;
}

.ticket-summary__text {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-line;
}

.ticket-summary__points {
  margin: 0 0 0.5rem;
  padding-left: 1.1rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.ticket-summary__points li + li {
  margin-top: 0.25rem;
}

/* Suggested reply panel (tickets/_canned_suggestion_panel): one row per
   suggested canned response, its name (and, on the first, Claude's reason)
   on the left and an action-size "Reply with this" on the right. Shares the
   AI summary panel's status, stale and meta text. */
.ticket-canned-suggestion__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
}

.ticket-canned-suggestion__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.ticket-canned-suggestion__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.ticket-canned-suggestion__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.ticket-canned-suggestion__reason {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
}

.ticket-canned-suggestion__use {
  flex: 0 0 auto;
}

.ticket-summary__status,
.ticket-summary__meta {
  margin: 0;
  font-size: 0.8rem;
}

.ticket-summary__status--alert {
  color: var(--danger-text);
  margin-bottom: 0.5rem;
}

.ticket-summary__stale {
  margin: 0 0 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  background: var(--notice-bg);
  color: var(--notice-text);
}

.ticket-time-spent__section-head {
  margin: 0 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ticket-time-spent__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--muted);
}

.ticket-time-spent__actions {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.ticket-time-spent__action-form {
  display: inline;
  margin: 0;
}

.ticket-time-spent__status {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.ticket-time-spent__status--notice {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
}

.ticket-time-spent__status--alert {
  background: color-mix(in srgb, var(--danger-text) 18%, transparent);
  color: var(--text);
}

.ticket-time-spent__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.ticket-time-spent__entry {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ticket-time-spent__entry-main {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.ticket-time-spent__entry:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.ticket-scenario-task-list {
  margin: 0.35rem 0 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ticket-scenario-task__row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.ticket-scenario-task__checkbox-form {
  display: inline-flex;
  margin: 0;
}

.ticket-scenario-task__checkbox {
  margin-top: 0.1rem;
}

.ticket-scenario-task__body {
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.ticket-scenario-task__title {
  color: var(--text);
  text-decoration: none;
}

.ticket-scenario-task__title:hover {
  color: var(--primary);
  text-decoration: underline;
}

.ticket-scenario-task__title--completed {
  color: var(--muted);
  text-decoration: line-through;
}

.ticket-scenario-task__title--completed:hover {
  color: var(--muted);
}

.ticket-scenario-task__title--unfinished {
  color: var(--muted);
}

.ticket-scenario-task__unfinish-form {
  display: inline;
  margin: 0;
}

.ticket-scenario-task__unfinish {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.2rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  vertical-align: -0.15em;
  cursor: pointer;
}

.ticket-scenario-task__unfinish:hover,
.ticket-scenario-task__unfinish:focus-visible {
  color: var(--danger-text);
  background: var(--danger-bg);
}

.ticket-time-spent__entry-line {
  min-width: 0;
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.35;
}

.ticket-time-spent__entry-sep {
  margin: 0 0.2em;
  color: var(--muted);
}

.ticket-time-spent__entry-actions {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
}

.ticket-time-spent__icon-btn {
  min-width: 2.25rem;
  padding: 0.2rem 0.45rem;
  font-size: 1rem;
  line-height: 1.2;
}

.ticket-time-spent__empty {
  margin: 0;
  font-size: 0.9rem;
}

.ticket-time-spent-dialog__fields {
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.ticket-time-spent-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ticket-time-spent-dialog__field label {
  font-size: 0.85rem;
  color: var(--muted);
}

.ticket-time-spent-dialog__field select,
.ticket-time-spent-dialog__datetime-input {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  min-width: 4.5rem;
}

.ticket-time-spent-dialog__datetime-input {
  min-width: 9.5rem;
}

.ticket-time-spent-dialog__datetime-input--time {
  min-width: 7rem;
}

.ticket-time-spent-dialog__note {
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ticket-time-spent-dialog__note-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.ticket-time-spent-dialog__note-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  resize: vertical;
}

.ticket-time-spent__entry-note {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.ticket-time-spent-dialog__actions {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

@media (max-width: 52rem) {
  .ticket-show__conversation-layout {
    grid-template-columns: 1fr;
  }

  .ticket-show__sidebar {
    position: static;
    order: 2;
    max-height: none;
    overflow: visible;
    margin-left: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .ticket-show__main,
  .ticket-show__conversation-layout .ticket-thread {
    order: 1;
  }
}

/* Ticket show: keep title toolbar + details panel visible while scrolling the thread. */
.ticket-show__sticky {
  display: flow-root;
  position: sticky;
  top: var(--app-header-offset, 0px);
  z-index: 10;
  background: var(--bg);
  isolation: isolate;
  box-shadow: 0 1px 0 var(--border);
  /* Keep spacing below the sticky bar; do not leave it as page-head
     margin-bottom (that made content sit tight to the top of the sticky). */
  margin-bottom: var(--ticket-show-head-gap, 1.25rem);
}

/* Full-viewport band behind the stuck page-head. Fixed so it spans
   edge-to-edge (the nav rail sits on top of it). Fades in when the sticky bar
   is pinned under the app header, keeping the page's own colours, and casts a
   shadow onto the page below so the bar reads as lifted over the
   conversation (by request; this replaced flipping the bar to the opposite
   light/dark palette). */
.ticket-show__sticky {
  transition: box-shadow 0.15s ease;
  --pinned-bar-shadow-ink: 1;
  --pinned-bar-shadow:
    0 8px 22px -8px color-mix(in srgb, #000 calc(20% * var(--pinned-bar-shadow-ink)), transparent),
    0 1px 0 color-mix(in srgb, #000 calc(8% * var(--pinned-bar-shadow-ink)), transparent);
}

/* A shadow barely shows on a dark page, so dark themes use more ink. */
html[data-user-theme="dark"] .ticket-show__sticky {
  --pinned-bar-shadow-ink: 2.6;
}

@media (prefers-color-scheme: dark) {
  html:not([data-user-theme]) .ticket-show__sticky {
    --pinned-bar-shadow-ink: 2.6;
  }
}

.ticket-show__sticky::before {
  content: "";
  position: fixed;
  top: var(--app-header-offset, 0px);
  left: 0;
  right: 0;
  height: var(--ticket-show-sticky-height, 40px);
  background: var(--bg);
  box-shadow: var(--pinned-bar-shadow);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: -1; /* behind page-head content, still inside the sticky stacking context */
}

.ticket-show__sticky.is-stuck::before {
  opacity: 1;
}

/* The band's shadow replaces the hairline under the bar while pinned. */
.ticket-show__sticky.is-stuck {
  box-shadow: 0 1px 0 transparent;
}

/* Ticket show: vertically center title, presence avatars, and action buttons
   so the entire page-head row shares one horizontal center plane. */
.ticket-show__sticky .page-head {
  align-items: center;
  margin-bottom: 0;
}

@media print {
  .app-shell__body:has(.ticket-show__sticky) > .app-header {
    position: static;
  }

  .ticket-show__sticky {
    position: static;
    box-shadow: none;
  }

  .ticket-show__sticky::before {
    display: none;
  }

  .ticket-thread__section-head {
    position: static;
    box-shadow: none;
  }

  .ticket-show__sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    margin-left: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .ticket-show__conversation-layout {
    display: block;
  }

  body.tickets-index--sticky-active .app-header,
  body.tickets-index--sticky-active .tickets-index .page-head,
  body.tickets-index--sticky-active .tickets-index .ticket-table-wrapper .table thead th {
    position: static;
    box-shadow: none;
  }

  body.tickets-index--sticky-active .dashboard-page .dashboard-scroll {
    max-height: none;
    overflow: visible;
  }
}

.page-head {
  /* Shared footprint for the page-head view switcher and quick-search input so
     the two controls stay the same width no matter how long a saved view name
     is. */
  --index-control-width: 12rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

/* Module page heads (the toolbar above every table, and the dashboard's).
   Controls come in three tiers:
     global (app header: workspace picker, New..., global search)  ~32px
     module (module page-head toolbars)                             28px
     action (table rows, drawers, ticket details head, footers)     24px
   The module tier sits a step below the header so the header still reads as
   the top level, without dropping to the tiny action size. Deliberately not
   --tickets-compact-control-height: that token keeps shrinking the action tier,
   and condensed view only tightens rows, never this toolbar. A new module page
   head opts in by joining this selector list and the sizing rules below. */
.page-head:has(.filter-form--tickets-index),
.dashboard-page > .page-head,
.control-row {
  --module-control-height: 28px;
}

/* Pages whose head draws the line under it (table pages, the dashboard):
   16px from the line to the content, a little tighter than the 20px other
   page heads keep (by request). */
.page-head:has(.filter-form--tickets-index),
.dashboard-page > .page-head {
  margin-bottom: 1rem;
}

/* Table-parity index pages: center page-head content and maintain comfortable
   title inset. */
.page-head:has(.filter-form--tickets-index) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

.tickets-index {
  --table-cell-pad-y: 0.5rem;
  --table-cell-pad-x: 0.75rem;
  --table-select-pad-y: 0.45rem;
  --tickets-compact-control-height: 24px;
}

/* User preference View=condensed: tighter row density across parity tables. */
html[data-user-table-view="condensed"] .tickets-index {
  --table-cell-pad-y: 0.28rem;
  --table-cell-pad-x: 0.6rem;
  --table-select-pad-y: 0.22rem;
  --tickets-compact-control-height: 20px;
}

/* User preference View=condensed: keep rows on a single line (no wrapping). */
html[data-user-table-view="condensed"] .tickets-index .ticket-table-wrapper .table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Condensed: Subject clips with ellipsis at the column edge (no Rails char cap),
   but only shrinks — it never grows past its text, so badges trail the subject
   instead of being pushed to the far side of the column. */
html[data-user-table-view="condensed"] .tickets-index .ticket-table-wrapper .table td[data-column-key="subject"] .ticket-table__subject-cell {
  display: flex;
  width: 100%;
  max-width: 100%;
}

html[data-user-table-view="condensed"] .tickets-index .ticket-table-wrapper .table td[data-column-key="subject"] .ticket-table__cell-link {
  display: block;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tickets-route {
  --tickets-compact-control-height: 24px;
}

.tickets-route .button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--tickets-compact-control-height);
  min-height: var(--tickets-compact-control-height);
  padding: 0.15rem 0.72rem;
  line-height: 1.15;
}

.canned-response-drawer,
.agent-task-drawer,
.scenario-drawer,
.scheduled-ticket-drawer,
.ticket-filters-drawer,
.requester-profile-drawer,
.portal-drawer,
.global-admin-user-drawer,
.global-admin-workspace-drawer,
.global-admin-directory-drawer,
.role-definition-drawer,
.permissions-drawer,
.user-preferences-drawer,
.asset-drawer,
.data-transfer-drawer,
.ticket-history-drawer,
.ticket-watchers-drawer,
.installed-application-drawer {
  --tickets-compact-control-height: 24px;
}

.canned-response-drawer .button,
.agent-task-drawer .button,
.scenario-drawer .button,
.scheduled-ticket-drawer .button,
.ticket-filters-drawer .button,
.requester-profile-drawer .button,
.portal-drawer .button,
.global-admin-user-drawer .button,
.global-admin-workspace-drawer .button,
.global-admin-directory-drawer .button,
.role-definition-drawer .button,
.permissions-drawer .button,
.user-preferences-drawer .button,
.asset-drawer .button,
.data-transfer-drawer .button,
.ticket-history-drawer .button,
.ticket-watchers-drawer .button,
.installed-application-drawer .button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--tickets-compact-control-height);
  min-height: var(--tickets-compact-control-height);
  padding: 0.15rem 0.72rem;
  line-height: 1.15;
}

.page-head:has(.filter-form--tickets-index) .page-head__title-view {
  gap: 0.75rem 1.25rem;
}

.page-head:has(.filter-form--tickets-index) .page-head__left {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 0.75rem 1rem;
  min-width: 0;
}

.page-head:has(.filter-form--tickets-index) .page-head__center {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}

.page-head:has(.filter-form--tickets-index) .page-head__right {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-self: end;
  justify-content: flex-end;
  gap: 0.75rem;
  min-width: 0;
}

.page-head:has(.filter-form--tickets-index) .page-head__right.filter-form--tickets-index {
  align-items: center;
}

.page-head:has(.filter-form--tickets-index) .page-head__title-view h1 {
  margin-inline-start: 8px;
}

.page-head:has(.filter-form--tickets-index) .button,
.dashboard-page > .page-head .button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--module-control-height);
  min-height: var(--module-control-height);
  padding: 0.15rem 0.72rem;
  font-size: 0.95rem;
  line-height: 1.15;
}

/* Square icon tools (export/import, columns, filters): same outline, radius
   and 18px glyph as the ticket bookmark / watchers buttons, sized to the
   module toolbar height. */
.page-head:has(.filter-form--tickets-index) .button.button--icon-only,
.dashboard-page > .page-head .button.button--icon-only {
  padding: 0;
  width: var(--module-control-height);
  flex-shrink: 0;
}

.page-head:has(.filter-form--tickets-index) .ticket-filters-apply > .ticket-details-field__input {
  box-sizing: border-box;
  height: var(--module-control-height);
  font-size: 0.95rem;
  line-height: 1.15;
  padding: 0.15rem 0.5rem;
  background: var(--surface);
}

.page-head:has(.filter-form--tickets-index) .ticket-view-switcher .custom-select__trigger,
.page-head:has(.filter-form--tickets-index) .ticket-view-switcher .ticket-view-switcher__select {
  box-sizing: border-box;
  height: var(--module-control-height);
}

.page-head:has(.filter-form--tickets-index) .ticket-filters-apply {
  flex-wrap: nowrap;
}

.page-head:has(.filter-form--tickets-index) .page-head__center .ticket-filters-apply {
  justify-content: center;
}

.page-head:has(.filter-form--tickets-index) .page-head__left .ticket-toolbar {
  flex-wrap: nowrap;
}

@media (max-width: 900px) {
  .page-head:has(.filter-form--tickets-index) {
    display: flex;
    flex-wrap: wrap;
  }

  .page-head:has(.filter-form--tickets-index) .page-head__center {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .page-head:has(.filter-form--tickets-index) .page-head__right {
    margin-left: auto;
  }
}

body.tickets-index--sticky-active .app-header {
  position: sticky;
  top: 0;
  z-index: 40;
}

/* Sticky index pages scroll inside .ticket-table-scroll only, so the document is
   locked to keep a page scrollbar from painting through right-side drawers.
   Pages using the sticky stack without a table scroller keep the document
   scrollbar, or their content below the fold becomes unreachable. */
html:has(body.tickets-index--sticky-active .ticket-table-scroll),
html:has(body.tickets-index--sticky-active .dashboard-scroll),
body.tickets-index--sticky-active:has(.ticket-table-scroll),
body.tickets-index--sticky-active:has(.dashboard-scroll) {
  overflow: hidden;
  height: 100%;
}

body.tickets-index--sticky-active .tickets-index .page-head {
  position: sticky;
  top: var(--tickets-sticky-page-head-top, 0px);
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

body.tickets-index--sticky-active .tickets-index .ticket-table-scroll {
  max-height: var(
    --tickets-sticky-table-max-height,
    calc(
      100vh - var(--tickets-sticky-table-head-top, 0px) - 1rem -
        var(--tickets-sticky-table-bottom-reserve, 5vh)
    )
  );
  overflow-x: hidden;
  overflow-y: auto;
}

body.tickets-index--sticky-active .dashboard-page .dashboard-scroll {
  max-height: var(
    --tickets-sticky-table-max-height,
    calc(
      100vh - var(--tickets-sticky-table-head-top, 0px) - 1rem -
        var(--tickets-sticky-table-bottom-reserve, 5vh)
    )
  );
  overflow-x: hidden;
  overflow-y: auto;
  /* Room for widget shadows and the GridStack south-east resize handle, which
     sit at the very edge of each cell and would otherwise be clipped. */
  padding-right: 0.25rem;
  padding-bottom: 0.5rem;
}

.assets-s1-sync-status {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--muted);
}

/* Reserved strip under the tickets table. Same type treatment as the /assets
   status strip so the two pages read alike. Status text sits left, the
   page-size control sits in the lower-right corner. */
.tickets-index-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
  min-height: var(--tickets-compact-control-height, 24px);
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--muted);
}

.tickets-index-footer__status {
  flex: 1 1 auto;
  min-width: 0;
}

.tickets-index-footer__controls {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* "Showing x–y of z" and the page arrows sit just left of the page-size
   control, at the strip's type size rather than the page head's. */
.tickets-index-footer .filter-form__count,
.tickets-index-footer .filter-form__pagination {
  font-size: inherit;
}

.tickets-index-footer .filter-form__pagination {
  flex-wrap: nowrap;
  gap: 0.25rem;
}

/* Previous / next page: square action-tier icon buttons (24px, never shrunk
   by condensed view, since the strip is not a table row). Disabled ends keep
   their place, dimmed by .button[aria-disabled="true"]. */
.tickets-index-footer .filter-form__pagination-button {
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  color: var(--text);
}

.tickets-index-footer .tickets-per-page {
  margin-inline-start: 0.5rem;
}

/* Sync status lines (/assets, directory detail) ride in the strip's left slot;
   the strip already supplies the gap above the table. */
.tickets-index-footer .assets-s1-sync-status {
  margin-top: 0;
}

.tickets-per-page {
  display: inline-flex;
  align-items: center;
}

.tickets-per-page__label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
}

/* Documented exception to control-shape-height-colors: that contract sets
   min-width 12rem for toolbar selects, which is far too wide for a three-digit
   row count. Colors, border and 6px radius still come from
   .ticket-view-switcher__select. Mirrors how .ticket-view-switcher constrains
   its own width, including the wrapper the global select-enhancer adds. */
.tickets-per-page__select.ticket-view-switcher__select {
  box-sizing: border-box;
  width: var(--tickets-per-page-control-width, 5.25rem);
  min-width: 0;
  max-width: 100%;
  height: var(--tickets-compact-control-height, 24px);
}

.tickets-per-page .custom-select {
  width: var(--tickets-per-page-control-width, 5.25rem);
  min-width: 0 !important;
}

.assets-s1-sync-status__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.75rem;
  row-gap: 0.35rem;
}

.assets-s1-sync-status__text--report {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
}

.assets-s1-sync-status__text--report:hover,
.assets-s1-sync-status__text--report:focus-visible {
  color: var(--primary);
  text-decoration: underline;
  outline: none;
}

.assets-s1-sync-status__sync-now {
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0.1rem 0.2rem;
}

.tickets-index .assets-s1-sync-status__sync-now.ticket-table__cell-link {
  margin: 0;
}

.assets-s1-sync-status__sync-now:disabled {
  opacity: 0.65;
  cursor: wait;
}

.assets-s1-sync-status__stop {
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: var(--danger-text);
  padding: 0.1rem 0.2rem;
}

.tickets-index .assets-s1-sync-status__stop.ticket-table__cell-link {
  margin: 0;
  color: var(--danger-text);
}

.tickets-index .assets-s1-sync-status__stop.ticket-table__cell-link:hover,
.tickets-index .assets-s1-sync-status__stop.ticket-table__cell-link:focus-visible {
  color: var(--danger-text);
}

.assets-s1-sync-status__stop:disabled {
  opacity: 0.65;
  cursor: wait;
}

.assets-s1-sync-status__status--failed {
  color: var(--danger-text);
}

.assets-s1-sync-status__meter {
  margin-top: 0.4rem;
  max-width: 28rem;
}

.assets-s1-sync-status__meter-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.assets-s1-sync-status__meter-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.15s ease;
  min-width: 2px;
}

.assets-s1-sync-status__meter-text {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.ticket-filters-dialog.assets-s1-sync-report {
  max-height: 70vh;
  flex-direction: column;
  overflow: hidden;
}

.ticket-filters-dialog.assets-s1-sync-report[open] {
  display: flex;
}

.assets-s1-sync-report__body {
  padding: 0.85rem 1.25rem 1rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.assets-s1-sync-report__summary {
  margin: 0;
  display: grid;
  gap: 0.45rem 1rem;
}

.assets-s1-sync-report__summary-row {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 0.5rem 1rem;
  align-items: baseline;
}

.assets-s1-sync-report__summary-row dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8125rem;
}

.assets-s1-sync-report__summary-row dd {
  margin: 0;
  font-size: 0.875rem;
}

.assets-s1-sync-report__status {
  font-weight: 600;
  text-transform: capitalize;
}

.assets-s1-sync-report__status--failed,
.assets-s1-sync-report__status--cancelled {
  color: var(--danger-text);
}

.assets-s1-sync-report__failure {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.assets-s1-sync-report__section {
  margin-top: 1.15rem;
}

.assets-s1-sync-report__section-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.assets-s1-sync-report__section-hint {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.assets-s1-sync-report__table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.assets-s1-sync-report__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.assets-s1-sync-report__table th,
.assets-s1-sync-report__table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.assets-s1-sync-report__table thead th {
  background: color-mix(in srgb, var(--border) 35%, transparent);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.assets-s1-sync-report__table tbody tr:last-child th,
.assets-s1-sync-report__table tbody tr:last-child td {
  border-bottom: 0;
}

.assets-s1-sync-report__hostname {
  font-weight: 600;
  white-space: nowrap;
}

.assets-s1-sync-report__mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  word-break: break-all;
}

.requesters-ad-sync-status {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--muted);
}

.requesters-ad-sync-status__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.75rem;
  row-gap: 0.35rem;
}

body.tickets-index--sticky-active .tickets-index .ticket-table-scroll.ticket-table-scroll--overflowing {
  overflow-x: auto;
}

.page-head__title-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  flex: 1;
  min-width: 0;
}

.page-head__title-tools h1 {
  margin: 0;
  font-size: 1.5rem;
  flex: 0 1 auto;
}

.ticket-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ticket-toolbar .button_to {
  display: inline;
}

.ticket-toolbar .button_to > form {
  display: inline;
  margin: 0;
}

.page-head h1 {
  margin: 0;
  font-size: 1.5rem;
}

.page-head__breadcrumb {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.page-head__breadcrumb-link {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

.page-head__breadcrumb-link:hover,
.page-head__breadcrumb-link:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.page-head > h1 {
  flex: 1;
  min-width: 0;
}

.ticket-show__sticky .page-head h1 {
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
}

.page-head__ticket-subject {
  white-space: normal;
}

.page-head__ticket-subject-input {
  display: none;
  box-sizing: border-box;
  min-width: 12rem;
  max-width: min(40rem, 100%);
  margin: 0;
  padding: 0.15rem 0.45rem;
  font: inherit;
  font-size: 1.25rem;
  font-weight: inherit;
  line-height: 1.35;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
}

.page-head__ticket-subject-input[readonly] {
  cursor: default;
  background: transparent;
  border-color: transparent;
  color: inherit;
  /* Keep padding so layout width matches the editable state, but remove the
     field chrome so it reads as title text on the page-head/h1 surface. */
  box-shadow: none;
}

.ticket-details-edit--active .ticket-show__sticky .page-head h1 {
  display: flex;
  width: 100%;
  flex-wrap: nowrap;
}

.ticket-details-edit--active .page-head__ticket-subject {
  display: none;
}

/* While editing, the Requester and Priority fields sit right below, so their
   read-only copies in the title bar would only repeat them. */
.ticket-details-edit--active .page-head__title-requester,
.ticket-details-edit--active .page-head__title-priority {
  display: none;
}

.ticket-details-edit--active .page-head__ticket-subject-input {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  /* Fallback only: ticket_details_edit_controller.js sets an authoritative
     inline max-width so the title input's right edge matches the requester
     picker. This calc is a reasonable pre-JS / no-JS approximation. */
  max-width: calc((100% - 2.5rem) / 2);
}

@media (max-width: 720px) {
  .ticket-details-edit--active .page-head__ticket-subject-input {
    max-width: 100%;
  }
}

.page-head__title-requester {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}

a.page-head__title-requester:hover {
  text-decoration: underline;
  color: var(--text);
}

button.page-head__ticket-id {
  appearance: none;
  border: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
  padding: 0.1rem 0.45rem;
}

button.page-head__ticket-id:hover {
  background: var(--primary-hover);
}

/* SLA badge and satisfaction icon beside the ticket ID (tickets/_head_badges). */
.page-head__ticket-badges {
  display: contents;
}

.page-head__ticket-badges .ticket-sla-badge {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 0.75rem;
}

.page-head__satisfaction-icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
  flex-shrink: 0;
}

.page-head__title-priority {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  vertical-align: middle;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Keep page-head priority centered (same specificity as .priority-color-picker__static). */
.page-head__title-priority.priority-color-picker__static {
  align-items: center;
}

.page-head__title-priority .priority-color-picker__swatch {
  width: 0.8rem;
  height: 0.8rem;
}

.page-head__title-edit-actions {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.5rem;
}

.page-head__title-undelete-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.page-head__title-edit-actions [data-ticket-details-edit-target="viewActions"],
.page-head__title-edit-actions [data-ticket-details-edit-target="editActions"] {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.page-head__title-edit-actions [data-ticket-details-edit-target="viewActions"][hidden],
.page-head__title-edit-actions [data-ticket-details-edit-target="editActions"][hidden] {
  display: none;
}

.create-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.create-menu--header {
  --tickets-compact-control-height: 24px;
}

.create-menu--header .create-menu__trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--tickets-compact-control-height);
  min-height: var(--tickets-compact-control-height);
  padding: 0.15rem 0.72rem;
  line-height: 1.15;
}

/* Deliberate exception to the compact-control height contract: in the app
   header the New... trigger takes its size from the same box model as the
   adjacent workspace select trigger, so both controls stay the same height even
   if that base font/padding changes. */
.app-header__workspace-row .create-menu--header .create-menu__trigger,
.app-header__workspace-row .app-header__ask-alfred {
  height: auto;
  min-height: 0;
  padding: 0.3rem 0.72rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

/* Every "…" (more actions) menu button shows the plain "…" character at the
   Tickets table's glyph size, whatever the button size around it (module 28px
   on table pages, compact 24px in record headers and drawers). Never an SVG.
   See .cursor/rules/More_Actions_Button.md. */
.create-menu__trigger.create-menu__trigger--more {
  font-size: 0.95rem;
}

.create-menu__panel {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 100;
  min-width: 11rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.create-menu__panel[hidden] {
  display: none;
}

.create-menu__item-form {
  display: block;
  margin: 0;
}

.create-menu__item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.65rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.create-menu__item:hover,
.create-menu__item:focus-visible {
  background: var(--bg);
  outline: none;
}

.create-menu__item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.create-menu__panel--end {
  left: auto;
  right: 0;
}

/* Sub-menu inside a "…" menu (menu_submenu_controller.js; first used by the
   ticket page's Status ›): the row ends in a chevron and its choices fly out
   beside it as a fixed panel the script places, so a scrolling parent (the
   right-click menu) can't clip it. Choices can lead with a colour swatch and
   end with a tick for the current one (tickets/_status_menu_items). */
.create-menu__submenu {
  position: relative;
}

/* A redrawable spot for one menu item (tickets/_pick_up_menu_item): no box
   of its own, so an empty slot adds no gap to the menu. */
.create-menu__item-slot {
  display: contents;
}

/* Menu rows set their own display, which would beat the hidden attribute
   (the tickets table hides Pick up when every selected ticket is yours). */
.create-menu__item[hidden],
.ticket-actions-menu__item[hidden] {
  display: none;
}

.create-menu__item--submenu,
.create-menu__item--status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.create-menu__item-label {
  flex: 1 1 auto;
  min-width: 0;
}

.create-menu__item-chevron,
.create-menu__item-check {
  flex: none;
  color: var(--muted);
}

.create-menu__item--submenu[aria-expanded="true"] {
  background: var(--bg);
}

/* The tickets table's menus style their rows with .ticket-actions-menu__item
   (display: block, defined later), so repeat the row layout at a higher
   specificity there. */
.ticket-actions-menu__item.create-menu__item--submenu,
.ticket-actions-menu__item.create-menu__item--status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* In the tickets table's menus the open row takes that menu's hover tint. */
.ticket-actions-menu__item.create-menu__item--submenu[aria-expanded="true"] {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

/* The table's choices always draw the tick, shown only on the checked one,
   so the list keeps its width as the selection changes. */
.create-menu__item--status[aria-checked="false"] .create-menu__item-check {
  visibility: hidden;
}

.create-menu__submenu-panel {
  min-width: 10rem;
  z-index: 1;
}

.create-menu__submenu-items {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ticket-page-head__toolbar .create-menu {
  --tickets-compact-control-height: 24px;
}

.ticket-page-head__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ticket-page-head__toolbar [data-ticket-details-edit-target="viewActions"],
.ticket-page-head__toolbar [data-ticket-details-edit-target="editActions"] {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ticket-page-head__toolbar [data-ticket-details-edit-target="viewActions"][hidden],
.ticket-page-head__toolbar [data-ticket-details-edit-target="editActions"][hidden] {
  display: none;
}

.ticket-page-head__list-nav {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ticket-page-head__list-nav [data-ticket-details-edit-target="viewActions"] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ticket-page-head__list-nav [data-ticket-details-edit-target="viewActions"][hidden] {
  display: none;
}

/* turbo-frame is inline by default, so the lazily loaded row-nav arrows need the
   same flex treatment the wrapping div used to give them. */
.ticket-page-head__row-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

a.ticket-watchers-button {
  display: inline-flex;
  margin: 0;
  text-decoration: none;
}

.ticket-watchers-button__icon {
  flex-shrink: 0;
}

.button.ticket-watchers-button--active {
  color: var(--badge-solution-text);
  border-color: color-mix(in srgb, var(--badge-solution-text) 40%, var(--border));
}

.ticket-watchers-button--active .ticket-watchers-button__icon circle {
  fill: color-mix(in srgb, currentColor 20%, transparent);
}

.ticket-bookmark-form {
  display: contents;
}

.ticket-bookmark-button {
  margin: 0;
}

.ticket-bookmark-button__icon {
  flex-shrink: 0;
}

.button.ticket-bookmark-button--active {
  color: var(--badge-solution-text);
  border-color: color-mix(in srgb, var(--badge-solution-text) 40%, var(--border));
}

.ticket-bookmark-button--active .ticket-bookmark-button__icon path {
  fill: color-mix(in srgb, currentColor 20%, transparent);
}

.ticket-presence-viewers {
  display: flex;
  align-items: center;
}

#ticket-presence-viewers-list {
  display: flex;
  align-items: center;
}

.ticket-presence-viewers__avatar + .ticket-presence-viewers__avatar {
  margin-left: -0.4rem;
}

.ticket-presence-viewers__avatar .avatar-badge {
  box-shadow: 0 0 0 2px var(--bg);
}

.ticket-presence-editing-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ticket-presence-editing-banner__item {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--notice-bg);
  color: var(--notice-text);
  white-space: nowrap;
}

/* The `display: inline-flex` above would otherwise beat the UA `[hidden]`
   rule, so hiding a self/own editing pill via `element.hidden = true`
   (ticket_presence_controller#hideIfSelf) has no visual effect. Restore it. */
.ticket-presence-editing-banner__item[hidden] {
  display: none;
}

.ticket-draft-lock-notice {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--notice-bg);
  color: var(--notice-text);
  white-space: nowrap;
}


.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 1rem;
}

.filter-form__count {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

.filter-form select {
  margin-left: 0.35rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

/* Inline search + submit in filter bar (e.g. global admin users). Overrides
   .ticket-details-field__input { width: 100% } so the field does not force a wrap. */
.ticket-filters-apply {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}

.ticket-filters-apply > .ticket-details-field__input {
  flex: 1 1 var(--index-control-width, 12rem);
  width: auto;
  min-width: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.table th,
.table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

/* Shared compact row density for table-parity pages. */
.tickets-index .ticket-table-wrapper .table th,
.tickets-index .ticket-table-wrapper .table td {
  padding: var(--table-cell-pad-y) var(--table-cell-pad-x);
}

.tickets-index .ticket-table-wrapper .table {
  border-radius: 0;
}

.tickets-index .ticket-table__th--select,
.tickets-index .ticket-table__td--select {
  padding-top: var(--table-select-pad-y);
  padding-bottom: var(--table-select-pad-y);
  padding-left: 0.3rem;
  padding-right: 0.3rem;
}

.tickets-index .ticket-table-wrapper .table tbody td a,
.tickets-index .ticket-table__cell-link {
  padding: 0.06rem 0.16rem;
  margin: -0.06rem -0.16rem;
}

.tickets-index .ticket-grid-edit__control,
.tickets-index .priority-color-picker__trigger--compact {
  box-sizing: border-box;
  height: var(--tickets-compact-control-height);
  min-height: var(--tickets-compact-control-height);
  padding: 0 0.35rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  line-height: 1.2;
}

.tickets-index .priority-color-picker__trigger--compact {
  font-size: inherit;
}

.tickets-index select.ticket-grid-edit__control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 1rem;
  background-repeat: no-repeat;
  background-position: right 0.3rem center;
  background-size: 0.55rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%23828a94' d='M0 0l5 6 5-6z'/></svg>");
}

@media (prefers-color-scheme: dark) {
  .tickets-index select.ticket-grid-edit__control {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%239ebacf' d='M0 0l5 6 5-6z'/></svg>");
  }
}

html[data-user-theme="light"] .tickets-index select.ticket-grid-edit__control {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%23828a94' d='M0 0l5 6 5-6z'/></svg>");
}

html[data-user-theme="dark"] .tickets-index select.ticket-grid-edit__control {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%239ebacf' d='M0 0l5 6 5-6z'/></svg>");
}

.tickets-index select.ticket-grid-edit__control::-ms-expand {
  display: none;
}

.tickets-index .ticket-grid-edit__control:focus-visible {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 1px;
  background: var(--surface);
}

.tickets-index .priority-color-picker__trigger--compact:focus-visible {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 1px;
  background: var(--surface);
}

.tickets-index .ticket-grid-edit__error {
  margin-top: 0.25rem;
}

/* Agent Tasks inline due date: show the same formatted text as other date columns;
   the native datetime input stays invisible and only anchors the opened picker. */
.agent-tasks-index .agent-task-due-inline {
  position: relative;
}

.agent-tasks-index .agent-task-due-inline__display {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  height: var(--tickets-compact-control-height);
  min-height: var(--tickets-compact-control-height);
  padding: 0 0.35rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.agent-tasks-index .agent-task-due-inline__display:hover {
  border-color: var(--border);
}

.agent-tasks-index .agent-task-due-inline__display:focus-visible {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 1px;
  background: var(--surface);
}

.agent-tasks-index .agent-task-due-inline__placeholder {
  color: var(--muted);
  visibility: hidden;
}

.agent-tasks-index .agent-task-due-inline__display:hover .agent-task-due-inline__placeholder,
.agent-tasks-index .agent-task-due-inline__display:focus-visible .agent-task-due-inline__placeholder {
  visibility: visible;
}

.agent-tasks-index .agent-task-due-inline__input {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg);
}

/* Click-to-sort headers on small tables (sortable_table_controller.js): the
   header text becomes a borderless button that keeps the header's own type,
   and the sorted column looks like the main tables' (bold --primary-hover
   label, ↑ / ↓). */
.sortable-table__sort {
  appearance: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: inherit;
  cursor: pointer;
}

.sortable-table__sort:hover .sortable-table__label,
.sortable-table__sort:focus-visible .sortable-table__label {
  text-decoration: underline;
}

.sortable-table__sort:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  outline-offset: 2px;
  border-radius: 2px;
}

.sortable-table__sort--active .sortable-table__label {
  color: var(--primary-hover);
  font-weight: 700;
}

.sortable-table__arrow {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--primary-hover);
}

.sortable-table__arrow:empty {
  display: none;
}

/* Light theme only: use brand SteelBlue for table header labels. */
html[data-user-theme="light"] .table th {
  color: var(--primary);
}

@media (prefers-color-scheme: light) {
  html:not([data-user-theme]) .table th {
    color: var(--primary);
  }
}

.ticket-table-wrapper .table thead {
  position: sticky;
  top: 0;
  z-index: 9;
}

.ticket-table-wrapper .table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
}

body.tickets-index--sticky-active .tickets-index .ticket-table-wrapper .table thead {
  top: 0;
  z-index: 25;
}

body.tickets-index--sticky-active .tickets-index .ticket-table-wrapper .table thead th {
  top: 0;
  z-index: 26;
}

/* Horizontal freeze for select + locked lead column (e.g. Name on /assets). */
.ticket-table__th--sticky-start,
.ticket-table__th--sticky-lead,
.ticket-table__td--sticky-start,
.ticket-table__td--sticky-lead {
  position: sticky;
}

.ticket-table__th--sticky-start,
.ticket-table__td--sticky-start {
  left: 0;
}

.ticket-table__th--sticky-lead,
.ticket-table__td--sticky-lead {
  left: var(--ticket-table-select-width, 2.5rem);
}

.ticket-table__td--sticky-start,
.ticket-table__td--sticky-lead {
  background: var(--surface);
  z-index: 4;
}

/* Match/exceed thead th specificity (.ticket-table-wrapper .table thead th)
   so frozen headers stay above scrolling siblings. */
.ticket-table-wrapper .table thead th.ticket-table__th--sticky-start,
.ticket-table-wrapper .table thead th.ticket-table__th--sticky-lead {
  z-index: 30;
  background: var(--bg);
}

body.tickets-index--sticky-active .tickets-index .ticket-table-wrapper .table thead th.ticket-table__th--sticky-start,
body.tickets-index--sticky-active .tickets-index .ticket-table-wrapper .table thead th.ticket-table__th--sticky-lead {
  z-index: 31;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ticket-table-wrapper {
  position: relative;
  --ticket-table-select-width: 2.5rem;
}

.ticket-table-wrapper .table {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
}

.ticket-table__th--select,
.ticket-table__td--select {
  width: 2.5rem;
  min-width: 2.5rem;
  max-width: 2.5rem;
  text-align: center;
  vertical-align: middle;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.ticket-table__select-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0;
}

/* Live tickets index: keep the pagination wrapper invisible to layout so the
   count + nav stay direct flex children of the filter form toolbar. */
.tickets-pagination-wrap {
  display: contents;
}

/* Resolved and Closed tickets share a muted, un-bold row treatment (Alfred does
   not auto-promote Resolved → Closed; both mean the ticket is done). */
.ticket-row--closed {
  color: var(--muted);
}

.ticket-row--closed .ticket-table__cell-link,
.ticket-row--closed .table tbody td a {
  font-weight: 400;
}

.ticket-row--closed .priority-color-picker__trigger,
.ticket-row--closed .ticket-grid-edit__control {
  color: var(--muted);
}

/* Briefly highlight rows that arrive or change via the live reconcile so a busy
   agent notices the update without a jarring full-table refresh. */
.ticket-row--live-new > td {
  animation: ticket-row-live-flash 1.6s ease-out 1;
}

@keyframes ticket-row-live-flash {
  0% {
    background-color: color-mix(in srgb, var(--primary) 22%, transparent);
  }
  100% {
    background-color: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticket-row--live-new > td {
    animation: none;
  }
}

.ticket-table__th--draggable {
  position: relative;
}

/* Columns hidden from the Columns drawer (ticket-table#applyColumnVisibility);
   keeps the UA [hidden] rule winning over any table-cell display. */
.ticket-table-wrapper th[data-column-key][hidden],
.ticket-table-wrapper td[data-column-key][hidden] {
  display: none;
}

.ticket-table__col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  margin-right: -4px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  z-index: 2;
}

/* The last column's handle must stay inside the table, or its -4px overhang
   gives tables that otherwise fit a horizontal scrollbar. */
.ticket-table__th:last-child > .ticket-table__col-resizer {
  margin-right: 0;
}

.ticket-table__col-resizer:hover {
  background: color-mix(in srgb, var(--primary) 22%, transparent);
}

.ticket-table-wrapper--resizing {
  cursor: col-resize;
  user-select: none;
}

.ticket-table-wrapper--dragging .ticket-table__sort-link,
.ticket-table-wrapper--dragging .ticket-column-menu__trigger {
  pointer-events: none;
}

.ticket-table__th-inner {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.25rem;
}

/* Header: menu + drag handle share the row; without flex-grow the menu stays
   shrink-to-fit and the label ellipsizes inside a still-wide <th>. */
.ticket-table__th-inner > .ticket-column-menu {
  flex: 1 1 auto;
  min-width: 0;
}

.ticket-table__th-inner > .ticket-column-menu .ticket-column-menu__trigger {
  width: 100%;
  min-width: 0;
}

.ticket-table__th-inner > .ticket-column-menu .ticket-column-menu__label {
  flex: 1 1 auto;
  min-width: 0;
}

/* Static (menu-less) header labels match .ticket-column-menu__trigger, whose
   <button> UA styles reset the uppercase + tracking from `.table th`. */
.ticket-table__th-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

.ticket-table__th--fixed .ticket-table__th-inner {
  justify-content: flex-end;
}

.ticket-table__th--numeric .ticket-column-menu__label {
  text-align: right;
}

.table td.ticket-table__td--numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ticket-table__drag-handle {
  flex-shrink: 0;
  cursor: grab;
  width: 1rem;
  color: var(--muted);
  line-height: 1;
  user-select: none;
  touch-action: none;
}

.ticket-table__drag-handle::before {
  content: "⋮⋮";
  display: block;
  font-size: 0.65rem;
  letter-spacing: -0.1em;
  opacity: 0.75;
}

.ticket-table__drag-handle:hover::before {
  opacity: 1;
}

.ticket-table__drag-handle:active {
  cursor: grabbing;
}

.ticket-table-wrapper--dragging .ticket-table__th--dragging {
  opacity: 0.65;
}

.ticket-table__th--drop-target {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.table tbody td a,
.ticket-table__cell-link,
.ticket-table__sort-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  border-radius: 4px;
  padding: 0.1rem 0.2rem;
  margin: -0.1rem -0.2rem;
}

.table tbody td a:visited,
.table tbody td a:active,
.ticket-table__cell-link:visited,
.ticket-table__cell-link:active,
.ticket-table__sort-link:visited,
.ticket-table__sort-link:active {
  color: inherit;
}

.table tbody td a:hover,
.table tbody td a:focus-visible,
.ticket-table__cell-link:hover,
.ticket-table__cell-link:focus-visible,
.ticket-table__sort-link:hover,
.ticket-table__sort-link:focus-visible {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.ticket-table__sort-link--active {
  color: var(--text);
}

.ticket-table__sort-link--active:hover {
  color: var(--primary);
}

.ticket-table__sort-link--asc::after {
  content: " \2191";
  font-weight: 400;
  opacity: 0.85;
}

.ticket-table__sort-link--desc::after {
  content: " \2193";
  font-weight: 400;
  opacity: 0.85;
}

.ticket-table__sort-link--inactive {
  cursor: default;
  font-weight: 600;
  padding: 0.1rem 0;
}

.ticket-table__sort-link--inactive:hover {
  color: inherit;
  background: none;
}

/* Column header sort + filter menu (tickets index) */
.ticket-column-menu {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.ticket-column-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.1rem 0.35rem;
  margin: -0.1rem -0.35rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.ticket-column-menu__trigger:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.ticket-column-menu__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-column-menu__caret {
  flex-shrink: 0;
  font-size: 0.65rem;
  opacity: 0.75;
}

/* Header text is already var(--primary), so the sorted column uses the secondary
   accent to read as emphasis rather than blending into the other headers. */
.ticket-column-menu__sort-arrow {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--primary-hover);
}

.ticket-column-menu__trigger--sorted .ticket-column-menu__label {
  color: var(--primary-hover);
  font-weight: 700;
}

.ticket-column-menu__filter-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.ticket-column-menu__panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body.tickets-index--sticky-active .tickets-index .ticket-column-menu__panel {
  z-index: 80;
}

.ticket-column-menu__panel[hidden] {
  display: none !important;
}

.ticket-column-menu__panel.is-open {
  display: flex !important;
}

.ticket-column-menu__section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ticket-column-menu__section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ticket-column-menu__sort-link {
  display: block;
  padding: 0.25rem 0.35rem;
  border-radius: 4px;
}

.ticket-column-menu__form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ticket-column-menu__field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.ticket-column-menu__field-label {
  color: var(--muted);
}

.ticket-column-menu__input {
  width: 100%;
  min-width: 0;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.ticket-column-menu__input--dimmed,
.ticket-column-menu__input:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.ticket-column-menu__blank-options {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.15rem;
}

.ticket-column-menu__checkbox-list,
.ticket-column-menu__radio-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 11rem;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.ticket-column-menu__check-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
}

.ticket-column-menu__check-row:hover {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.ticket-column-menu__check-row--hidden {
  display: none;
}

.ticket-column-menu__row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ticket-column-menu__text-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}

.ticket-column-menu__form-actions {
  margin-top: 0.15rem;
}

.ticket-column-menu__form-actions .button {
  width: 100%;
}

.ticket-column-menu__clear-wrap {
  margin-top: 0.25rem;
}

.ticket-column-menu__clear {
  font-size: 0.8rem;
}

/* Item styling shared by the tickets row right-click menu and the page-head "…"
   menu, so the two always look alike. Each menu supplies its own panel chrome:
   .ticket-context-menu below for the row menu, .create-menu__panel for the
   page-head one. */
.ticket-actions-menu__item {
  display: block;
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: none;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ticket-actions-menu__item:hover,
.ticket-actions-menu__item:focus {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  outline: none;
}

.ticket-actions-menu__item--danger {
  color: var(--danger-text);
}

.ticket-actions-menu__item--danger:hover,
.ticket-actions-menu__item--danger:focus {
  background: var(--danger-bg);
}

/* Buttons carry :disabled; Open is an anchor, which cannot. */
.ticket-actions-menu__item:disabled,
.ticket-actions-menu__item--disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.ticket-actions-menu__separator {
  height: 1px;
  margin: 0.25rem 0.15rem;
  background: var(--border);
}

/* Right-click menu for tickets index rows. Shares the column-menu surface
   treatment but sits above open column menus (z-index 80). */
.ticket-context-menu {
  position: fixed;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 11rem;
  padding: 0.35rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.ticket-context-menu[hidden] {
  display: none !important;
}

.ticket-context-menu.is-open {
  display: flex !important;
}

@media print {
  .ticket-context-menu,
  .ticket-actions-menu-button {
    display: none !important;
  }
}

.ticket-grid-edit {
  margin: 0;
}

.ticket-grid-edit__control {
  width: 100%;
  min-width: 0;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.ticket-grid-edit__error {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--danger-text);
}

/* Category typeahead in grid: wrappers must not add height/spacing */
.tickets-index .ticket-grid-edit .requester-picker,
.tickets-index .ticket-grid-edit .requester-picker__field {
  width: 100%;
  min-width: 0;
}

/* Match Priority/Group/Status/Assignee dropdown chrome */
.tickets-index .ticket-grid-edit .requester-picker__suggestions {
  background: var(--bg);
  border-radius: 8px;
  padding: 0.25rem;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 14%, transparent);
}

.tickets-index .ticket-grid-edit .requester-picker__suggestion {
  border-radius: 6px;
  white-space: nowrap;
}

.tickets-index .ticket-grid-edit .requester-picker__suggestion:hover,
.tickets-index .ticket-grid-edit .requester-picker__suggestion--active {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--border);
}

.badge--open {
  background: var(--badge-open-bg);
  color: var(--badge-open-text);
}

.badge--in_progress {
  background: var(--badge-in-progress-bg);
  color: var(--badge-in-progress-text);
}

.badge--resolved {
  background: var(--badge-resolved-bg);
  color: var(--badge-resolved-text);
}

.badge--closed {
  background: var(--badge-closed-bg);
  color: var(--badge-closed-text);
}

.badge--priority-urgent {
  background: var(--badge-priority-urgent-bg);
  color: var(--badge-priority-urgent-text);
}

.badge--priority-high {
  background: var(--badge-priority-high-bg);
  color: var(--badge-priority-high-text);
}

.badge--priority-medium {
  background: var(--badge-priority-medium-bg);
  color: var(--badge-priority-medium-text);
}

.badge--priority-low {
  background: var(--badge-priority-low-bg);
  color: var(--badge-priority-low-text);
}

.badge--solution {
  background: var(--badge-solution-bg);
  color: var(--badge-solution-text);
}

.badge--solution-toggle {
  border: 0;
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}

.badge--solution-toggle:hover,
.badge--solution-toggle:focus-visible {
  filter: brightness(0.95);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--badge-solution-text) 40%, transparent);
  outline: none;
}

.badge--merged {
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Conversation parts a requester created in the customer portal. */
.badge--portal {
  background: rgba(37, 99, 235, 0.16);
  color: var(--text);
  border: 1px solid rgba(37, 99, 235, 0.4);
}

.badge--split {
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
}

.badge--duplicated {
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Sister tickets (Tickets::Sisters): title-row chips, "From sister" on
   conversation parts another team posted, "Shared to sister" on this team's
   parts that were copied over, and the tickets-table marker. A
   primary tint so another team's work stands out from this team's own. */
.badge--sister {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--primary) 45%, transparent);
  white-space: nowrap;
}

.badge--sister a,
a.badge--sister {
  color: inherit;
  text-decoration: none;
}

.badge--sister a:hover,
a.badge--sister:hover {
  text-decoration: underline;
}

/* Tickets table marker: sized like the New / Needs reply pill beside it
   (.ticket-reply-state-badge) so the subject cell reads as one row of pills. */
.badge--sister-compact {
  flex-shrink: 0;
  padding: 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.badge--deleted {
  background: var(--danger-bg);
  color: var(--danger-text);
}

/* SLA state. Three levels of the same danger hue rather than three colours, so
   the hierarchy reads at a glance: a live breach is filled, one already on the
   record is outlined, and an approaching deadline is a light tint. Derived from
   --danger-* with color-mix so both themes follow without new tokens. A settled
   pass is the one exception: green, so it never reads as something to act on. */
.badge--sla-overdue {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid color-mix(in srgb, var(--danger-text) 35%, transparent);
}

.badge--sla-missed {
  background: transparent;
  color: var(--danger-text);
  border: 1px solid color-mix(in srgb, var(--danger-text) 45%, transparent);
}

.badge--sla-due-soon {
  background: color-mix(in srgb, var(--danger-text) 12%, transparent);
  color: var(--danger-text);
  border: 1px solid color-mix(in srgb, var(--danger-text) 22%, transparent);
}

.badge--sla-on-time {
  background: var(--badge-solution-bg);
  color: var(--badge-solution-text);
  border: 1px solid color-mix(in srgb, var(--badge-solution-text) 35%, transparent);
}

/* Reply state (Tickets::ReplyState). Two levels of the brand hue, the same
   filled-vs-tint hierarchy as the SLA badges: "Needs reply" (someone wrote back
   and is waiting on us) is filled; "New" (nobody has replied yet) is a tint.
   Kept off the danger hue so it never competes with an SLA breach. */
.badge--reply-needed {
  background: var(--primary);
  color: var(--on-primary);
  border: 1px solid var(--primary);
}

.badge--reply-new {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
}

/* Sits alongside a subject link or a ticket number, so it must not be the thing
   that grows the row, and must never be the part of the cell that gets squeezed. */
.ticket-sla-badge,
.ticket-reply-state-badge {
  flex-shrink: 0;
  padding: 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.ticket-activity-badge {
  flex-shrink: 0;
  padding: 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ticket-details-field__value .ticket-sla-badge {
  margin-left: 0.5rem;
}

.empty,
.muted {
  color: var(--muted);
}

.meta {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.35rem 1rem;
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.meta dt {
  margin: 0;
  color: var(--muted);
}

.meta dd {
  margin: 0;
}

.ticket-details-form {
  margin-bottom: 1.5rem;
}

.ticket-details-panel {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* Global-admin SSO settings: wider form column, longer labels, grouped panels. */
.sso-settings-lead {
  max-width: 64rem;
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.sso-settings-form,
.sso-settings-panel {
  max-width: 64rem;
}

.sso-settings-panel + .sso-settings-panel,
.sso-settings-form + .sso-settings-panel {
  margin-top: 1.25rem;
}

.sso-settings-form .sso-settings-panel:last-child {
  margin-bottom: 0;
}

.sso-settings-panel__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.sso-settings-panel__hint {
  margin: 0 0 0.85rem;
}

.sso-settings-field-hint {
  margin: -0.15rem 0 0.65rem;
  padding-left: calc(14rem + 0.75rem);
}

.sso-settings-form .ticket-details-field,
.sso-settings-panel .ticket-details-field {
  grid-template-columns: 14rem minmax(0, 1fr);
}

.sso-settings-form .ticket-details-field > .ticket-details-field__label,
.sso-settings-panel .ticket-details-field > .ticket-details-field__label {
  padding-top: 0.35rem;
  align-self: start;
}

.sso-settings-cert {
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
}

.sso-settings-hours {
  max-width: 8rem;
}

.sso-settings-sp-value {
  font-size: 0.85rem;
  word-break: break-all;
}

@media (max-width: 40rem) {
  .sso-settings-form .ticket-details-field,
  .sso-settings-panel .ticket-details-field {
    grid-template-columns: 1fr;
    row-gap: 0.35rem;
  }

  .sso-settings-field-hint {
    padding-left: 0;
  }

  .sso-settings-form .ticket-details-field > .ticket-details-field__label,
  .sso-settings-panel .ticket-details-field > .ticket-details-field__label {
    padding-top: 0;
  }
}

.ticket-details-panel:not(.ticket-details-panel--editing) .ticket-details-field__control {
  display: none !important;
}

/* The global select-enhancer wraps each native <select> in a .custom-select
   container, which is not matched by the control-hide rule above. Hide the
   wrapper too so enhanced selects stay hidden in view mode. */
.ticket-details-panel:not(.ticket-details-panel--editing) .ticket-details-field__value > .custom-select {
  display: none !important;
}

.ticket-details-panel--editing .ticket-details-field__static {
  display: none !important;
}

/* Read-only rows (Created) have no edit control, so keep their value showing,
   inset by the controls' border + padding so its text lines up with theirs. */
.ticket-details-panel--editing .ticket-details-field__static.ticket-details-field__static--readonly {
  display: inline !important;
  padding-left: calc(0.5rem + 1px);
}

.ticket-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 2.5rem;
  align-items: start;
}

@media (max-width: 720px) {
  .ticket-details-grid {
    grid-template-columns: 1fr;
  }
}

.ticket-details-col {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

/* The ticket page's panel only: both columns sit on its five shared row tracks
   (subgrid), so each row is as tall as the taller field in it and the dividers
   line up across the columns, even in edit mode where the priority/status
   pickers are taller than plain inputs. Stacked on narrow screens, the columns
   simply follow each other. Exactly five rows: a column with more (the print
   copy, the Freshservice archive, admin forms) would pile the extras into the
   last row, so those keep the plain stacked column above. */
#ticket_details_panel .ticket-details-col {
  display: grid;
  grid-row: span 5;
  grid-template-rows: subgrid;
  row-gap: 0;
}

/* The ticket page's panel shares the main column with the conversation
   (~70% wide), so it is squeezed: narrower labels and gap, and the two
   columns stack when the panel itself is too narrow for both. A container
   query, because the panel's width depends on the rail and window, not the
   window alone. */
.ticket-show__main > .ticket-details-form {
  container: ticket-details / inline-size;
}

#ticket_details_panel .ticket-details-grid {
  column-gap: 1.5rem;
}

#ticket_details_panel .ticket-details-field {
  grid-template-columns: 7.5rem minmax(0, 1fr);
}

@container ticket-details (max-width: 44rem) {
  #ticket_details_panel .ticket-details-grid {
    grid-template-columns: 1fr;
  }

  /* Stacked, the first column's last row sits mid-list. */
  #ticket_details_panel .ticket-details-col:first-child > .ticket-details-field:last-child {
    border-bottom: 1px solid var(--border);
  }
}

/* The requester row arrives inside a wrapper (its live-update target); let the
   field fill the row like the others. */
#ticket_details_panel .ticket-details-col > :not(.ticket-details-field) {
  display: grid;
}

.ticket-details-field {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.25rem 0;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.ticket-details-field--remote-changed .ticket-details-field__label {
  color: var(--badge-solution-text);
}

.ticket-details-field__remote-dot {
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  margin-top: -0.275rem;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 25%, transparent);
  animation: ticket-remote-dot-fade 8s ease-out forwards;
  pointer-events: none;
}

.ticket-details-field--remote-changed {
  padding-left: 0.9rem;
}

@keyframes ticket-remote-dot-fade {
  0%,
  70% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.ticket-details-field--align-top {
  align-items: start;
}

.ticket-details-col > .ticket-details-field:last-child {
  border-bottom: none;
}

/* Stacked on narrow screens, the first column's last row sits mid-list. */
@media (max-width: 720px) {
  #ticket_details_panel .ticket-details-col:first-child > .ticket-details-field:last-child {
    border-bottom: 1px solid var(--border);
  }
}

.ticket-details-field__label {
  margin: 0;
  padding: 0;
  color: var(--muted);
}

.ticket-details-field--suggest-input > .ticket-details-field__label {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.ticket-details-field--suggest-input > .ticket-details-field__label::after {
  content: "";
  width: 0.82rem;
  height: 0.82rem;
  flex: 0 0 auto;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='10' r='5.5'/%3E%3Cpath d='M14.2 14.2L19 19'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='10' r='5.5'/%3E%3Cpath d='M14.2 14.2L19 19'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.ticket-details-field__label--control-column {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ticket-details-field__value {
  margin: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 2rem;
}

.ticket-details-field__satisfaction-icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  max-height: 1.25rem;
  object-fit: contain;
  flex-shrink: 0;
}

.ticket-details-field__static--stack > * + * {
  margin-top: 0.25rem;
}

.ticket-details-field__value.ticket-details-field__static--stack {
  align-items: flex-start;
  flex-direction: column;
}

.ticket-details-field--static-stack-row {
  align-items: flex-start;
}

/* Secondary value trailing a primary one on the same row (e.g. office location
   after department). Matches the relative-time caption treatment. */
.ticket-details-field__static--muted {
  margin-left: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.ticket-details-field__static--requester-line .ticket-details-field__requester-email-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
}

.ticket-details-field__static--requester-line .ticket-details-field__requester-manager-email-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
}

.ticket-details-field__static--requester-line {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.ticket-details-field__requester-email-icon {
  width: 0.95rem;
  height: 0.95rem;
}

.ticket-details-field__static--requester-line .ticket-details-field__requester-email-link:hover {
  color: var(--primary);
  background: var(--bg-subtle);
}

.ticket-details-field__static--requester-line .ticket-details-field__requester-manager-email-link:hover {
  color: var(--primary);
  background: var(--bg-subtle);
}

.ticket-details-panel .ticket-details-field__value > .ticket-details-field__control {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Enhanced selects are wrapped in .custom-select, so the rule above no longer
   matches them. Stretch the wrapper to fill the value column in edit mode, and
   override the per-select inline min-width the enhancer applies so all selects
   match the full-width requester input. */
.ticket-details-panel--editing .ticket-details-field__value > .custom-select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0 !important;
}

.ticket-details-panel .priority-color-picker__trigger {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-details-field__input {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0.35rem 0.5rem;
  font: inherit;
  line-height: 1.35;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.ticket-details-field__control--stack .ticket-details-field__input + .ticket-details-field__input {
  margin-top: 0.35rem;
}

.permissions-ticket-groups-combobox {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.permissions-ticket-groups-combobox__options {
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.permissions-ticket-groups-combobox__option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 1.9rem;
  margin: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  font-weight: normal;
  cursor: pointer;
}

.permissions-ticket-groups-combobox__option:hover {
  background: var(--bg-subtle);
}

.permissions-ticket-groups-combobox__option:focus-within {
  background: var(--bg-subtle);
  outline: 1px solid var(--primary);
  outline-offset: -1px;
}

.permissions-ticket-groups-combobox__checkbox {
  margin: 0;
}

/* Scenarios — grouped section (heading + bordered body) */
.scenario-form-group {
  margin-top: 1rem;
}

.scenario-form-group__heading {
  margin: 0 0 0.5rem;
  padding-top: 0.35rem;
  font-weight: 600;
}

.scenario-form-group__body {
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}

.scenario-form-group__hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
}

.scenario-form-group__body > .ticket-details-field:last-child {
  border-bottom: none;
}

/* Scenarios — nested step editor (drawer / full form) */
.scenario-steps-editor {
  margin-top: 1rem;
}

.scenario-steps-editor__heading {
  margin: 0 0 0.5rem;
  padding-top: 0.35rem;
  font-weight: 600;
}

.scenario-steps-editor__nested {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.scenario-steps-editor__add {
  align-self: flex-start;
  margin-bottom: 0.75rem;
}

.scenario-step-row {
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}

.scenario-step-row__grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scenario-step-row__pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem 1rem;
  align-items: start;
}

.scenario-step-row__pair--single {
  grid-template-columns: 1fr;
}

.scenario-step-row__field--full {
  grid-column: 1 / -1;
}

.scenario-step-row__field--inline {
  grid-template-columns: 9rem minmax(0, 1fr);
}

.scenario-step-row__field--inline .ticket-details-field__label {
  grid-column: 1;
  padding-top: 0.35rem;
}

.scenario-step-row__field--inline .ticket-details-field__input {
  grid-column: 2;
}

.scenario-step-row__field--inline.scenario-step-row__field--inline-narrow {
  grid-template-columns: 9rem auto;
}

.scenario-step-row__field--inline-narrow .ticket-details-field__input {
  min-width: 6ch;
  width: 8ch;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 720px) {
  .scenario-step-row__pair {
    grid-template-columns: 1fr;
  }

  .scenario-step-row__field--full {
    grid-column: auto;
  }

  .scenario-step-row__field--inline {
    grid-template-columns: 1fr;
  }

  .scenario-step-row__field--inline .ticket-details-field__label,
  .scenario-step-row__field--inline .ticket-details-field__input {
    grid-column: auto;
  }

  .scenario-step-row__field--inline-narrow .ticket-details-field__input {
    width: 100%;
    max-width: 100%;
  }
}

.scenario-step-row .scenario-step-row__field.ticket-details-field {
  border-bottom: none;
  padding: 0.35rem 0;
}

/* Let label + control columns share the row: grid items default min-width:auto can
   collapse the control track so selects stay ~intrinsic width instead of filling 1fr. */
.scenario-step-row__pair > .ticket-details-field {
  min-width: 0;
}

.scenario-step-row__pair .ticket-details-field__input {
  min-width: 0;
}

.scenario-step-row__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
  padding-top: 0.25rem;
}

.requester-picker__field {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.recipient-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  min-width: 0;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: text;
}

.recipient-chips:focus-within,
.recipient-chips--drop-target {
  border-color: var(--primary);
}

.recipient-chips__list {
  display: contents;
}

.recipient-chips__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.1rem 0.2rem 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.4;
  cursor: grab;
}

.recipient-chips__chip--dragging {
  opacity: 0.45;
}

.recipient-chips__chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient-chips__chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.recipient-chips__chip-remove:hover {
  background: var(--border);
  color: var(--text);
}

.recipient-chips__chip-remove svg {
  width: 0.7rem;
  height: 0.7rem;
}

.recipient-chips__input {
  flex: 1 1 8rem;
  min-width: 8rem;
  border: 0 !important;
  background: transparent !important;
  padding: 0.2rem 0.15rem !important;
  outline: none;
}

.ticket-details-field__value > .requester-picker.ticket-details-field__control {
  width: 100%;
  min-width: 0;
}

.suggest-input__field {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.requester-picker__suggestions {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0.15rem 0 0;
  padding: 0.2rem 0;
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.suggest-input__list {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0.15rem 0 0;
  padding: 0.2rem 0;
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.requester-picker__suggestion {
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
  line-height: 1.35;
  cursor: pointer;
}

.requester-picker__suggestion-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.requester-profile__name-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.requester-user-badge {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

.requester-user-badge__icon {
  width: 0.9rem;
  height: 0.9rem;
}

.avatar-badge {
  --avatar-color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--avatar-color);
  color: #fff;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  user-select: none;
  overflow: hidden;
}

.avatar-badge--xs {
  width: 1.25rem;
  height: 1.25rem;
  font-size: 0.6rem;
}

.avatar-badge--sm {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.7rem;
}

.avatar-badge--md {
  width: 2rem;
  height: 2rem;
  font-size: 0.8rem;
}

.avatar-badge--lg {
  width: 3rem;
  height: 3rem;
  font-size: 1.1rem;
}

.avatar-badge--image {
  background: var(--surface);
}

.avatar-badge__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

button.avatar-badge {
  padding: 0;
  border: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.photo-lightbox {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  width: 50vw;
  height: 50vh;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.photo-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.photo-lightbox__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.photo-lightbox__close:hover {
  background: var(--bg-subtle);
}

.photo-lightbox__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
}

/* Block-level, not inline-flex: an inline-flex box takes its baseline from the
   avatar badge, which differs between photo badges (no text) and initials
   badges, shifting the cell vertically per row. */
.ticket-table__from-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.ticket-table__subject-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.ticket-table__satisfaction-badge {
  display: block;
  width: 1rem;
  height: 1rem;
  max-height: 1rem;
  object-fit: contain;
  flex-shrink: 0;
}

.ticket-table__from-cell .ticket-table__cell-link {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-field {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.avatar-field__controls {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

/* Avatar row: preview badge stacked beneath the "Icon" label in column 1,
   initials label + input + color picker on one row in column 2. */
.avatar-field__icon-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.avatar-field__controls-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.avatar-field__controls-row > .avatar-field__initials-label {
  margin: 0;
  padding: 0;
}

.avatar-field__initials-input {
  max-width: 6rem;
  text-transform: uppercase;
}

#requester-profile-form .avatar-field__controls-row > .avatar-field__color {
  flex: 1 1 0;
  min-width: 0;
}

.avatar-field__color .theme-color-picker__trigger {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  line-height: 1.35;
}

.suggest-input__option {
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
  line-height: 1.35;
  cursor: pointer;
}

.requester-picker__suggestion:hover,
.requester-picker__suggestion--active {
  background: var(--bg);
}

.user-picker__field {
  position: relative;
  width: 100%;
  min-width: 0;
}

.user-picker__input {
  width: 100%;
}

.user-picker__suggestions {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0.15rem 0 0;
  padding: 0.25rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
}

.user-picker__suggestion {
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.user-picker__suggestion:hover,
.user-picker__suggestion--active {
  background: var(--bg);
}

.suggest-input__option:hover,
.suggest-input__option--active {
  background: var(--bg);
}

.ticket-picker__clear-link {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.875rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  color: inherit;
  opacity: 0.85;
}

.ticket-picker__clear-link:hover {
  opacity: 1;
}

/* Agent task related ticket: full width + columnar suggestions */
.ticket-picker.ticket-details-field__control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.ticket-picker .requester-picker__field {
  width: 100%;
  min-width: 0;
}

.ticket-picker .requester-picker__input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.ticket-picker .ticket-picker__suggestions {
  min-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.ticket-picker__suggestions-header,
.ticket-picker__suggestion-row {
  display: grid;
  grid-template-columns: minmax(4.75rem, 0.22fr) minmax(0, 1fr) minmax(0, 0.88fr);
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.35rem 0.55rem;
  margin: 0;
  list-style: none;
}

.ticket-picker__suggestions-header {
  padding-top: 0.25rem;
  padding-bottom: 0.3rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  cursor: default;
}

.ticket-picker__suggestion-row {
  font-size: 0.85rem;
  line-height: 1.35;
  cursor: pointer;
}

.ticket-picker__suggestion-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-picker__suggestion-row.requester-picker__suggestion--active {
  background: var(--bg);
}

select.ticket-details-field__input {
  padding: 0.3rem 0.45rem;
}

.ticket-timeline {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.5rem;
}

.ticket-timeline__absolute {
  line-height: 1.35;
}

.ticket-timeline__relative,
.ticket-created-by__detail {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.ticket-body {
  background: var(--surface);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ticket-body h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--muted);
}

.ticket-body__text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
}

/* Only shown when a runaway conversation trips the render cap. */
.ticket-thread__cap-notice {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--muted);
}

/* Long conversations load after the rest of the ticket page
   (_thread_messages_loading); message-shaped placeholders hold the space. */
.ticket-thread__loading-status,
.ticket-thread__loading-failed {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.ticket-thread__loading-status[hidden],
.ticket-thread__loading-failed[hidden] {
  display: none;
}

.ticket-thread__loading-spinner {
  flex: none;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ticket-print-preparing-spin 0.8s linear infinite;
}

.ticket-thread__skeleton {
  display: grid;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem 1.4rem;
  margin-bottom: 1rem;
  animation: ticket-thread-skeleton-pulse 1.4s ease-in-out infinite;
}

.ticket-thread__skeleton:nth-of-type(2) { animation-delay: 0.15s; }
.ticket-thread__skeleton:nth-of-type(3) { animation-delay: 0.3s; }

.ticket-thread__loading-failed:not([hidden]) ~ .ticket-thread__skeleton {
  animation: none;
}

.ticket-thread__skeleton-line {
  display: block;
  height: 0.7rem;
  border-radius: 4px;
  background: var(--border);
}

.ticket-thread__skeleton-line--head {
  width: 35%;
  margin-bottom: 0.4rem;
}

.ticket-thread__skeleton-line--short {
  width: 60%;
}

@keyframes ticket-thread-skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .ticket-thread__skeleton {
    animation: none;
  }

  .ticket-thread__loading-spinner {
    animation-duration: 2.4s;
  }
}

.ticket-thread__section-head {
  position: sticky;
  top: calc(var(--app-header-offset, 0px) + var(--ticket-section-sticky-top, 5.5rem));
  z-index: 9;
  margin: 0 0 0.75rem;
  padding-block: 0.375rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 8px -6px color-mix(in srgb, var(--bg) 85%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ticket-thread__section-head h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.ticket-thread__section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ticket-thread__section-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Replaced as one unit by thread_sync; its buttons stay flex items of the actions row. */
.ticket-thread__order-controls {
  display: contents;
}

.ticket-thread__sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
}

/* Newest on top: the compose panel moves above the message list. It is
   reordered visually rather than moved in the page, so a TinyMCE draft
   survives toggling the order (ticket_thread_sort_controller.js). */
.ticket-thread:has(> #ticket-thread-messages[data-order="newest_first"]) {
  display: flex;
  flex-direction: column;
}

.ticket-thread:has(> #ticket-thread-messages[data-order="newest_first"]) > #ticket-thread-messages {
  order: 1;
}

/* Only offered once the ticket title bar has pinned (is-stuck), i.e. the user has scrolled down. */
.ticket-thread__scroll-top {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

.ticket-show__layout:has(> .ticket-show__sticky.is-stuck) .ticket-thread__scroll-top {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.15s ease, visibility 0s;
}

/* Offered until the page is scrolled to the bottom (is-at-bottom, from scroll_to_latest_controller.js). */
.ticket-thread__scroll-latest {
  transition: opacity 0.15s ease, visibility 0s;
}

.ticket-thread__scroll-latest.is-at-bottom {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

.ticket-message {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.ticket-message--remote-added {
  animation: ticket-message-remote-flash 2.5s ease-out;
}

@keyframes ticket-message-remote-flash {
  0% {
    background-color: color-mix(in srgb, var(--badge-solution-bg) 70%, var(--surface));
    border-color: color-mix(in srgb, var(--badge-solution-text) 40%, var(--border));
  }

  100% {
    background-color: var(--surface);
    border-color: var(--border);
  }
}

.ticket-live-jump-chip {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 60;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.55rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--badge-solution-text) 35%, var(--border));
  border-radius: 999px;
  background: var(--badge-solution-bg);
  color: var(--badge-solution-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  animation: flash-toast-slide-down 180ms ease-out;
}

.ticket-live-jump-chip:hover,
.ticket-live-jump-chip:focus-visible {
  filter: brightness(0.97);
  outline: none;
}

.ticket-message--outgoing {
  border-left: 4px solid var(--primary);
}

.ticket-message__header {
  margin-bottom: 0.75rem;
}

.ticket-message__header-leading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.ticket-message__solution-badge {
  margin-left: auto;
}

.ticket-message__header-trailing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* Only meaningful when the conversation renders dark. */
.ticket-message__light-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.ticket-message__light-toggle:hover,
.ticket-message__light-toggle:focus-visible {
  border-color: var(--border);
  color: var(--text);
}

.ticket-message__light-toggle[aria-pressed="true"] {
  border-color: var(--border);
  background: var(--bg-subtle);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  html:not([data-user-theme="light"]) .ticket-message__light-toggle {
    display: inline-flex;
  }
}

html[data-user-theme="dark"] .ticket-message__light-toggle {
  display: inline-flex;
}

.ticket-message__note-view-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ticket-message--note-mutable .ticket-message__edit--note {
  display: none;
}

.ticket-message--note-editing {
  border-left: 1px solid var(--border);
}

.ticket-message--note-editing .ticket-message__header,
.ticket-message--note-editing .ticket-message__meta {
  display: none;
}

.ticket-message--note-editing .ticket-message__static {
  display: none;
}

.ticket-message--note-editing .ticket-message__attachments {
  display: none;
}

.ticket-message--note-editing .ticket-message__edit--note {
  display: block;
  width: 100%;
  max-width: none;
}

.ticket-message__meta {
  display: grid;
  /* 6rem fits the longest label ("Attachments") with room before its value. */
  grid-template-columns: 6rem 1fr;
  gap: 0.3rem 0.75rem;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.ticket-message__meta dt {
  margin: 0;
  color: var(--muted);
}

.ticket-message__meta dd {
  margin: 0;
}

/* Incoming mail's Attachments row: one file per line, no bullets, so the
   names line up with the From / To / Subject values above. */
.ticket-message__meta-attachment-list {
  display: grid;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticket-message__meta-attachment-list li {
  overflow-wrap: anywhere;
}

.ticket-message__body {
  overflow-wrap: anywhere;
  margin-top: 0.15rem;
}

/* Message HTML carries light-dark() pairs for its inline colors
   (TicketMessages::DarkModeColors), so the well follows the inherited
   color-scheme; the per-message toggle pins one message back to light. The
   dark well is fixed rather than var(--bg), which follows the user's page
   color; DarkModeColors' lightness targets assume this background. */
.ticket-message__body-content {
  background: light-dark(#ffffff, #212121);
  color: light-dark(#1f2328, #e8e8e8);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  overflow-x: auto;
}

.ticket-message--light-body .ticket-message__body-content {
  color-scheme: light;
}

.ticket-message__body img,
.ticket-message__body video {
  max-width: 100%;
  height: auto;
}

/* Outlook writes one paragraph per line and zeroes their margins in a head
   <style> block that inbound cleaning strips. Keep in sync with CONTENT_STYLE
   in tinymce_controller.js and layouts/mailer.html.erb. */
:is(.ticket-message__body-content, .portal-message__body, .fs-message__body)
  :is(.MsoNormal, .MsoNoSpacing, .MsoPlainText, .MsoListParagraph,
      .MsoListParagraphCxSpFirst, .MsoListParagraphCxSpMiddle, .MsoListParagraphCxSpLast) {
  margin-top: 0;
  margin-bottom: 0;
}

/* Neutralize fixed-width email wrappers so nested media can scale down */
.ticket-message__body table {
  max-width: 100%;
}

.ticket-message__body table[width] {
  width: auto;
}

.ticket-message--editable-original .ticket-message__edit,
.ticket-message--editable-original .ticket-message__edit-control {
  display: none;
}

.ticket-details-edit--active .ticket-message--editable-original .ticket-message__edit,
.ticket-details-edit--active .ticket-message--editable-original .ticket-message__edit-control {
  display: block;
}

.ticket-details-edit--active .ticket-message--editable-original .ticket-message__static {
  display: none;
}

.ticket-message--editable-original .ticket-message__meta-subject .ticket-message__edit-control {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ticket-message__editor-status {
  margin-top: 0.35rem;
}

.ticket-message__quoted-wrap {
  margin-top: 0.65rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.ticket-message__quoted-summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 0.9rem;
  list-style: none;
}

.ticket-message__quoted-summary::-webkit-details-marker {
  display: none;
}

.ticket-message__quoted-label--open,
.ticket-message__quoted-wrap[open] .ticket-message__quoted-label--closed {
  display: none;
}

.ticket-message__quoted-wrap[open] .ticket-message__quoted-label--open {
  display: inline;
}

/* Keyed to the well's own color-scheme rather than the theme tokens, so a
   message toggled back to light keeps light-legible quoted chrome. */
.ticket-message__body-content .ticket-message__quoted-wrap {
  border-top-color: light-dark(#e1e2e4, #3a3a3a);
}

.ticket-message__body-content .ticket-message__quoted-summary {
  color: light-dark(#123d4d, #9ebacf);
}

.ticket-message__body-content .ticket-message__quoted {
  color: light-dark(#828a94, #a8b0b9);
  border-left-color: light-dark(#e1e2e4, #524070);
}

.ticket-message__quoted {
  margin-top: 0.5rem;
  padding-left: 0.5rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}

.ticket-message__quoted-heading {
  color: light-dark(#828a94, #a8b0b9);
  font-size: 0.85rem;
}

/* Off-screen frame that loads tickets#print for ticket_print_frame_controller.
   Sized rather than display: none, which would print blank. */
.ticket-print-frame {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 1100px;
  height: 800px;
  border: 0;
  pointer-events: none;
}

/* Dims the page while a print copy loads (ticket_print_frame_controller.js).
   Fades in after a beat so quick prints don't flash; sits above drawers. */
.ticket-print-preparing {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  cursor: progress;
  animation: ticket-print-preparing-in 180ms ease-out 150ms both;
}

.ticket-print-preparing__card {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-size: 0.9rem;
}

.ticket-print-preparing__hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.ticket-print-preparing__spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ticket-print-preparing-spin 0.8s linear infinite;
}

@keyframes ticket-print-preparing-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ticket-print-preparing-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ticket-print-preparing {
    animation: none;
  }

  .ticket-print-preparing__spinner {
    animation-duration: 2.4s;
  }
}

@media print {
  .ticket-print-preparing {
    display: none !important;
  }
}

.ticket-print-ready {
  align-items: center;
}

/* Ticket print / audit copy (tickets#print). */
.ticket-print__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}

.ticket-print__section {
  margin-bottom: 1.75rem;
}

.ticket-print__section-title {
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--border);
  font-size: 1.15rem;
}

.ticket-print__details .ticket-details-field__value {
  gap: 0.5rem;
}

.ticket-print__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.ticket-print__table th,
.ticket-print__table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.ticket-print__table th {
  color: var(--muted);
  font-weight: 600;
}

.ticket-print__task-title {
  font-weight: 600;
}

.ticket-print__note {
  white-space: pre-wrap;
}

.ticket-print__note p {
  margin: 0.25rem 0 0;
  white-space: normal;
}

@page ticket-print {
  margin: 12mm;
}

@media print {
  /* Smaller root size so every rem-based size on the audit copy scales down together. */
  /* The named page goes on the root: on .ticket-print itself, the hidden
     chrome before and after it forces a blank page at each boundary. */
  html:has(.ticket-print) {
    color-scheme: light;
    font-size: 11px;
    page: ticket-print;
  }

  body:has(.ticket-print) {
    line-height: 1.4;
  }

  .app-shell:has(.ticket-print) {
    min-height: 0;
  }

  .ticket-print .page-head h1 {
    font-size: 1.6rem;
  }

  .ticket-print__meta {
    margin-bottom: 0.75rem;
  }

  .ticket-print__section {
    margin-bottom: 1.25rem;
  }

  .ticket-print__section-title {
    margin-bottom: 0.4rem;
    padding-bottom: 0.2rem;
    border-bottom-width: 1px;
    font-size: 1.2rem;
  }

  .ticket-print__details {
    gap: 0 1.75rem;
  }

  .ticket-print__details .ticket-details-field {
    grid-template-columns: 7rem minmax(0, 1fr);
    min-height: 0;
    padding: 0.2rem 0;
    font-size: 1rem;
  }

  .ticket-print__details .ticket-details-field__value {
    min-height: 0;
  }

  .ticket-print .ticket-message {
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.6rem;
  }

  .ticket-print .ticket-message__header {
    margin-bottom: 0.4rem;
  }

  .ticket-print .ticket-message__meta {
    gap: 0.1rem 0.75rem;
    margin-bottom: 0.4rem;
  }

  /* Email bodies carry their own inline px/pt sizes, which ignore the smaller
     root size; zoom shrinks those too while font-size keeps plain notes legible. */
  .ticket-print .ticket-message__body-content {
    padding: 0.25rem 0.5rem;
    font-size: 1.15rem;
    zoom: 0.85;
  }

  .ticket-print__table th,
  .ticket-print__table td {
    padding: 0.25rem 0.5rem;
  }

  .ticket-print {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --text: #000000;
    --muted: #4b5563;
    --border: #d1d5db;
    --primary: #123d4d;
    color: #000000;
  }

  body:has(.ticket-print) {
    background: #ffffff;
  }

  body:has(.ticket-print) .app-rail,
  body:has(.ticket-print) .app-header,
  body:has(.ticket-print) .flash-stack,
  .ticket-print__toolbar {
    display: none !important;
  }

  .app-shell__body:has(.ticket-print) .main {
    padding: 0;
  }

  .ticket-print .ticket-message {
    border-color: #d1d5db;
  }

  .ticket-print .ticket-message__body-content {
    background: #ffffff;
    color: #000000;
    overflow: visible;
  }

  .ticket-print .ticket-message__quoted {
    color: #374151;
    border-left-color: #d1d5db;
    font-size: 1em;
  }

  .ticket-print__message .ticket-message__header,
  .ticket-print__message .ticket-message__meta {
    break-after: avoid;
  }

  .ticket-print__table tr,
  .ticket-print__details .ticket-details-field {
    break-inside: avoid;
  }

  .ticket-print__section-title {
    break-after: avoid;
  }
}

.ticket-message__attachments ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.message-form {
  max-width: 52rem;
}

.message-form.message-form--thread {
  max-width: none;
}

/* TinyMCE's oxide-dark skin is navy (#222f3e); retint the chrome to the app's
   dark surfaces so the editor sits in the compose form like the other fields.
   The skin stylesheet loads after this file, hence the html[...] prefix for
   specificity. tinymce_controller.js sets the attribute when it picks the skin;
   the editing surface itself is styled by CONTENT_STYLE there. */
html[data-tinymce-skin="oxide-dark"] .tox.tox-tinymce {
  border: 1px solid var(--border);
  border-radius: 6px;
}

html[data-tinymce-skin="oxide-dark"] .tox .tox-editor-header,
html[data-tinymce-skin="oxide-dark"] .tox .tox-toolbar,
html[data-tinymce-skin="oxide-dark"] .tox .tox-toolbar__overflow,
html[data-tinymce-skin="oxide-dark"] .tox .tox-toolbar__primary,
html[data-tinymce-skin="oxide-dark"] .tox .tox-tbtn,
html[data-tinymce-skin="oxide-dark"] .tox .tox-split-button {
  background-color: var(--surface);
}

html[data-tinymce-skin="oxide-dark"] .tox .tox-editor-header {
  border-bottom: 1px solid var(--border);
}

html[data-tinymce-skin="oxide-dark"] .tox .tox-toolbar__primary {
  background-image: none;
}

html[data-tinymce-skin="oxide-dark"] .tox .tox-tbtn:hover,
html[data-tinymce-skin="oxide-dark"] .tox .tox-split-button:hover,
html[data-tinymce-skin="oxide-dark"] .tox .tox-tbtn:focus:not(.tox-tbtn--disabled) {
  background-color: #3a3a3a;
  outline: none;
}

html[data-tinymce-skin="oxide-dark"] .tox .tox-tbtn--enabled,
html[data-tinymce-skin="oxide-dark"] .tox .tox-tbtn--enabled:hover,
html[data-tinymce-skin="oxide-dark"] .tox .tox-tbtn--enabled:focus {
  background-color: var(--primary);
  color: var(--on-primary);
}

html[data-tinymce-skin="oxide-dark"] .tox .tox-tbtn--enabled svg {
  fill: var(--on-primary);
}

html[data-tinymce-skin="oxide-dark"] .tox .tox-menu,
html[data-tinymce-skin="oxide-dark"] .tox .tox-collection--list,
html[data-tinymce-skin="oxide-dark"] .tox .tox-swatches-menu,
html[data-tinymce-skin="oxide-dark"] .tox .tox-dialog,
html[data-tinymce-skin="oxide-dark"] .tox .tox-dialog__header,
html[data-tinymce-skin="oxide-dark"] .tox .tox-dialog__footer {
  background-color: var(--surface);
  border-color: var(--border);
}

html[data-tinymce-skin="oxide-dark"] .tox .tox-collection--list .tox-collection__item--active {
  background-color: #3a3a3a;
}

.message-form--compact-meta .form__field {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  column-gap: 0.75rem;
  row-gap: 0.25rem;
  align-items: start;
  margin-bottom: 0.5rem;
}

.message-form--compact-meta .form__field[hidden] {
  display: none;
}

.message-form--compact-meta .form__field > label,
.message-form--compact-meta .form__field > .form__field-meta-label {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  padding-top: 0.45rem;
  font-weight: 500;
  white-space: nowrap;
}

.message-form--compact-meta .form__field > input[type="text"] {
  grid-column: 2;
  grid-row: 1;
}

.message-form--compact-meta .form__field > .requester-picker__field {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.message-form--compact-meta .form__field > .message-form__hint {
  grid-column: 2;
  grid-row: 2;
  margin-top: 0;
}

.message-form--compact-meta .form__field--message {
  align-items: start;
}

.message-form--compact-meta .form__field--attachments {
  align-items: center;
}

.message-form--compact-meta .form__field--message > label,
.message-form--compact-meta .form__field--attachments > .form__field-meta-label {
  grid-column: 1;
  grid-row: 1;
}

.message-form--compact-meta .form__field--attachments > .form__field-meta-label {
  padding-top: 0;
  align-self: center;
}

.message-form--compact-meta .form__field--message .form__field--message-editor,
.message-form--compact-meta .form__field--attachments .form__field--attachments-controls {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.message-form--compact-meta .form__field--message .message-form__hint,
.message-form--compact-meta .form__field--message .message-form__status {
  margin-top: 0.35rem;
}

.message-form--compact-meta .form__field--attachments .message-form__hint {
  margin-top: 0.35rem;
}

.message-form--compact-meta .form__field--attachments .form__field--attachments-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.message-form__attachments-dropzone {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tickets-compact-control-height, 2.25rem);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--surface);
  line-height: 1.15;
}

.message-form__attachments-dropzone.is-dragging {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--primary) inset;
}

.message-form__attachments-empty {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Compact drop zone (no Choose... button): the text opens the picker. */
.message-form__attachments-empty--choose {
  cursor: pointer;
}

.message-form__attachments-empty--choose:hover {
  color: var(--text);
  text-decoration: underline;
}

.message-form__attachments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  min-width: 0;
}

.message-form__attachments-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted, var(--surface));
  padding: 0.05rem 0.4rem 0.05rem 0.55rem;
}

.message-form__attachments-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(20rem, 45vw);
  font-size: 0.9rem;
}

.message-form__attachments-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  line-height: 0;
  padding: 0.15rem;
  border-radius: 999px;
  cursor: pointer;
}

.message-form__attachments-remove:hover {
  color: var(--danger, var(--text));
  background: var(--surface);
}

.message-form__attachments-remove:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.message-form--compact-meta .form__field--attachments .message-form__file-browse {
  margin-left: auto;
  margin-right: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Canned responses (new/edit): Visibility radios stack and left-align inside the value column. */
.canned-response-form__visibility {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
}

.canned-response-form__visibility-option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 400;
  cursor: pointer;
}

.ticket-compose__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}

.ticket-compose__heading {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
}

.ticket-compose__header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* Canned response row in ticket compose: shares the message-form--compact-meta
   grid so the label and select column align with the Message label and editor. */
.message-form--compact-meta .form__field--canned > .ticket-compose__canned-label {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  padding-top: 0.45rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted);
  cursor: pointer;
}

.message-form--compact-meta .form__field--canned > .ticket-compose__canned-control {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.ticket-compose__canned-control .custom-select {
  min-width: 14rem !important;
}

.ticket-compose__canned-control .ticket-compose__canned-select.ticket-details-field__input {
  flex: 0 1 auto;
  min-width: 14rem;
  max-width: 20rem;
  width: auto;
  min-height: var(--tickets-compact-control-height, 2.25rem);
  padding: 0.25rem 0.45rem;
  line-height: 1.15;
  border-radius: 6px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.ticket-compose__canned-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

@media (max-width: 42rem) {
  .message-form--compact-meta .form__field--canned > .ticket-compose__canned-control {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .ticket-compose__canned-control .ticket-compose__canned-select.ticket-details-field__input {
    max-width: 100%;
    min-width: 0;
    width: 100%;
  }

  .ticket-compose__canned-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

.message-form textarea {
  min-height: 14rem;
}

.message-form--compact-meta textarea {
  min-height: min(22rem, 50vh);
  max-height: 50vh;
  overflow-y: auto;
}

.message-form input[type="text"],
.message-form textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.message-form__hint {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.message-form__status {
  margin-top: 0.45rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}

.message-form__status--info {
  background: var(--notice-bg);
  color: var(--notice-text);
}

.message-form__status--error {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.message-compose-actions__solution-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--muted);
  cursor: pointer;
}

.message-compose-actions__solution-label input[type="checkbox"] {
  margin: 0;
}

/* "Share with sister" only shows in Note mode; inline-flex above would
   otherwise beat the [hidden] attribute the composer toggles. */
.message-compose-actions__solution-label[hidden] {
  display: none;
}

.form {
  max-width: 24rem;
}

.user-preferences-drawer__inner .form {
  max-width: none;
}

.form__fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem 1rem;
  margin: 0 0 1rem;
}

.form__legend {
  padding: 0 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.form__hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.form__radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.35rem;
}

.form__radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 400;
  cursor: pointer;
}

.form__field {
  margin-bottom: 1rem;
}

.form__field label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.form__field input[type="text"],
.form__field input[type="password"],
.form__field select,
.form__field textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.theme-color-picker {
  position: relative;
}

.theme-color-picker__trigger {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.theme-color-picker__swatch {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
  background: var(--theme-color-picker-swatch);
  flex-shrink: 0;
}

.theme-color-picker__caret {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.theme-color-picker__list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 14%, transparent);
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 14rem;
  overflow-y: auto;
}

.theme-color-picker__option {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 0.4rem 0.45rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-color-picker__option:hover,
.theme-color-picker__option:focus-visible {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  outline: none;
}

.theme-color-picker__option--selected {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

/* ── Priority color picker combo box ─────────────────────────────────────── */

.priority-color-picker {
  position: relative;
}

.priority-color-picker__trigger {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.priority-color-picker__trigger--compact {
  padding: 0.3rem 0.5rem;
  font-size: 0.875rem;
}

.priority-color-picker__swatch {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
  background: var(--priority-swatch-color, var(--muted));
  flex-shrink: 0;
}

.priority-color-picker__static {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.priority-color-picker__swatch--static {
  flex-shrink: 0;
}

.priority-color-picker__caret {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.priority-color-picker__list {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 14%, transparent);
  /* position and coordinates are set by the Stimulus controller (position:fixed) */
  position: absolute;
  z-index: 200;
  max-height: 14rem;
  overflow-y: auto;
}

.priority-color-picker__option {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 0.4rem 0.45rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.priority-color-picker__option:hover,
.priority-color-picker__option:focus-visible {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  outline: none;
}

.priority-color-picker__option--selected {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

/* ── Priority options editor (admin form) ────────────────────────────────── */

.priority-options-editor {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 28rem;
}

.priority-options-editor__row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Matches the vertical rhythm of the SLA targets table rows. */
.priority-options-editor__row + .priority-options-editor__row {
  margin-top: 0.6rem;
}

.priority-options-editor__swatch-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.priority-options-editor__color-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.priority-options-editor__swatch {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: box-shadow 0.1s;
}

.priority-options-editor__swatch:hover {
  box-shadow: 0 0 0 2px var(--primary);
}

.priority-options-editor__value-input {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.5rem;
}

.priority-options-editor__remove {
  flex-shrink: 0;
  color: var(--muted);
}

.priority-options-editor--with-description {
  max-width: 52rem;
}

.priority-options-editor--with-description .priority-options-editor__value-input {
  flex: 0 0 12rem;
}

.priority-options-editor__description-input {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.5rem;
}

/* Complexity's first column is a point value rather than a name, so it needs
   far less room than a status or priority label. */
.priority-options-editor--complexity .priority-options-editor__value-input,
.priority-options-editor--complexity.priority-options-editor--readonly .priority-options-editor__label {
  flex: 0 0 5rem;
}

/* Horizontal padding mirrors the list surface's padding, and each span's
   inset mirrors the input's padding + border, so headings sit over the text. */
.priority-options-editor__head--complexity {
  color: var(--muted);
  display: flex;
  font-size: 0.85rem;
  font-weight: 500;
  gap: 0.6rem;
  padding: 0 0.5rem;
}

.priority-options-editor__head--complexity > span {
  box-sizing: border-box;
  padding-left: calc(0.5rem + 1px);
}

.priority-options-editor__head--complexity > span:first-child {
  flex: 0 0 5rem;
}

.priority-options-editor__remove:hover {
  color: var(--danger-text);
}

.priority-options-editor--readonly .priority-options-editor__row {
  gap: 0.5rem;
}

.priority-options-editor--readonly .priority-options-editor__label {
  font-size: 0.9rem;
}

.priority-options-editor--readonly.priority-options-editor--with-description .priority-options-editor__label {
  flex: 0 0 12rem;
}

.priority-options-editor__description {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.priority-options-editor [data-priority-options-editor-target="list"] {
  background: var(--surface);
  border-radius: 6px;
  padding: 0.5rem;
}

.priority-options-editor__body {
  background: var(--surface);
  border-radius: 6px;
  padding: 0.5rem;
}

.priority-options-editor--with-sla {
  --priority-sla-duration-col: calc(5.5rem + 0.4rem + 7.5rem);
  max-width: min(100%, 70vw);
}

.priority-options-editor--with-sla [data-priority-options-editor-target="list"] {
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.priority-options-editor--with-sla .priority-options-editor__head,
.priority-options-editor--with-sla .priority-options-editor__row {
  display: grid;
  grid-template-columns:
    1.5rem
    minmax(7.5rem, 11rem)
    minmax(8rem, 1fr)
    var(--priority-sla-duration-col)
    var(--priority-sla-duration-col)
    1.75rem;
  align-items: center;
  column-gap: 0.6rem;
}

.priority-options-editor--with-sla .priority-options-editor__head {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
}

.priority-options-editor--with-sla .priority-options-editor__head > span:nth-child(4),
.priority-options-editor--with-sla .priority-options-editor__head > span:nth-child(5) {
  justify-self: start;
}

/* Inset headings by the input's padding + border so they sit over the text;
   read-only rows are plain text, so they keep the flush headings. */
.priority-options-editor--with-sla:not(.priority-options-editor--readonly) .priority-options-editor__head > span:nth-child(n + 2):nth-child(-n + 5) {
  padding-left: calc(0.5rem + 1px);
}

.priority-options-editor--with-sla .priority-options-editor__value-input,
.priority-options-editor--with-sla.priority-options-editor--with-description .priority-options-editor__value-input {
  flex: none;
  width: 100%;
}

.priority-options-editor--with-sla .priority-options-editor__description-input,
.priority-options-editor--with-sla .priority-options-editor__description {
  min-width: 0;
  width: 100%;
}

.priority-options-editor--with-sla.priority-options-editor--readonly .priority-options-editor__label {
  flex: none;
  min-width: 0;
}

.priority-options-editor__sla-readonly {
  font-size: 0.9rem;
  white-space: nowrap;
}

.priority-options-editor--with-sla .priority-options-editor__remove {
  justify-self: end;
}

.priority-options-editor__sla-priority {
  display: none;
}

@media (max-width: 70rem) {
  .priority-options-editor--with-sla {
    max-width: 100%;
  }

  .priority-options-editor--with-sla .priority-options-editor__head {
    display: none;
  }

  .priority-options-editor--with-sla .priority-options-editor__row {
    grid-template-columns: 1.5rem minmax(7.5rem, 12rem) minmax(8rem, 1fr) 1.75rem;
    grid-template-areas:
      "swatch label desc remove"
      ". first resolution resolution";
    row-gap: 0.45rem;
  }

  .priority-options-editor--with-sla .priority-options-editor__swatch-label,
  .priority-options-editor--with-sla .priority-options-editor__swatch {
    grid-area: swatch;
  }

  .priority-options-editor--with-sla .priority-options-editor__value-input,
  .priority-options-editor--with-sla .priority-options-editor__label {
    grid-area: label;
  }

  .priority-options-editor--with-sla .priority-options-editor__description-input,
  .priority-options-editor--with-sla .priority-options-editor__description {
    grid-area: desc;
  }

  .priority-options-editor--with-sla .priority-options-editor__remove {
    grid-area: remove;
  }

  .priority-options-editor--with-sla .workspace-sla__duration--first {
    grid-area: first;
  }

  .priority-options-editor--with-sla .workspace-sla__duration--resolution {
    grid-area: resolution;
  }

  .priority-options-editor--with-sla [data-duration-label]::before {
    color: var(--muted);
    content: attr(data-duration-label);
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    grid-column: 1 / -1;
  }

  .priority-options-editor--with-sla .workspace-sla__duration[data-duration-label] {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: start;
    column-gap: 0.4rem;
  }
}

#workspace_options_ticket_group,
#workspace_options_ticket_group_ro,
#workspace_options_category,
#workspace_options_category_ro {
  background: var(--surface);
}

/* Half the viewport is the resting height; textarea-autogrow grows longer lists
   from here down to the bottom of the viewport. */
.workspace-options__lines {
  min-height: 50vh;
}

.workspace-options__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  position: relative;
}

/* The selected tab's fill lives on this one element so it can slide between
   tabs instead of blinking on and off in two places. */
.workspace-options__tab-indicator {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-sizing: border-box;
  height: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  transition: transform 180ms ease, width 180ms ease, height 180ms ease;
  width: 0;
}

.workspace-options__tab-indicator--visible {
  opacity: 1;
}

.workspace-options__tab-indicator--instant {
  transition: none;
}

.workspace-options__tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.15;
  padding: 0.35rem 0.9rem;
  position: relative;
  z-index: 1;
}

.workspace-options__tab:hover {
  color: var(--text);
}

.workspace-options__tab[aria-selected="true"] {
  color: var(--text);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .workspace-options__tab-indicator {
    transition: none;
  }
}

.workspace-options__panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
}

/* Group/Status/Priority & SLA share Category's filled height; extra content
   scrolls inside the panel so the page never grows a scrollbar. The gap below
   the panel (margin + .main padding) is reserved for future status updates. */
.workspace-options__panel--scroll {
  height: var(--workspace-options-panel-max-height, auto);
  max-height: var(--workspace-options-panel-max-height, none);
  overflow-y: auto;
}

.workspace-options__section-title {
  font-size: 1rem;
  margin: 0 0 0.35rem;
}

.workspace-options__section .ticket-details-field__hint {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.workspace-ai-summary__input {
  background: var(--surface);
  font-family: monospace;
  max-width: 100%;
  width: 50vw;
}

.workspace-ai-summary__actions {
  margin-top: 0.5rem;
}

.workspace-ai-summary__locked,
.workspace-ai-summary__next {
  margin-top: 1.5rem;
}

.workspace-ai-summary__format {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
  max-width: 100%;
  padding: 0.6rem 0.75rem;
  white-space: pre-wrap;
  width: 50vw;
}

/* Workspace settings → AI settings: Ticket options' tabbed layout and prompt
   editors (.workspace-ai-summary__*), plus a small spend table. */
.ai-settings-page__toolbar {
  margin-left: auto;
}

.ai-settings-page__lead {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.ai-settings-page__section-intro {
  color: var(--muted);
  margin: 0 0 1rem;
}

.ai-settings-page__block {
  margin-top: 1.5rem;
}

.ai-settings-usage {
  box-shadow: none;
  font-size: 0.9rem;
  max-width: 100%;
  width: auto;
}

.ai-settings-usage th,
.ai-settings-usage td {
  padding: 0.4rem 0.75rem;
}

.ai-settings-usage thead th,
.ai-settings-usage tfoot th,
.ai-settings-usage tfoot td {
  font-weight: 600;
}

.ai-settings-usage .ai-settings-usage__num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Alfred settings → Case notes (global_admin/case_notes): rollout steps as
   panels like the Freshservice import page, and the pilot review cards. */
.case-notes__intro,
.case-notes__muted {
  color: var(--muted);
}

.case-notes__intro {
  margin: 0 0 1.25rem;
  max-width: 70rem;
}

.case-notes__muted {
  font-size: 0.85rem;
}

.case-notes__warning {
  background: var(--danger-bg);
  border-radius: 6px;
  color: var(--danger-text);
  margin: 0 0 1.25rem;
  padding: 0.6rem 0.85rem;
}

.case-notes__panel,
.case-notes__pilot-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
}

.case-notes__panel-head {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.case-notes__panel-head h2,
.case-notes__pilot-title {
  font-size: 1rem;
  margin: 0;
}

.case-notes__facts {
  display: grid;
  gap: 0.3rem 1rem;
  grid-template-columns: max-content 1fr;
  margin: 0.75rem 0 0;
}

.case-notes__facts dt {
  color: var(--muted);
}

.case-notes__facts dd {
  margin: 0;
}

/* Archive progress on Global Admin → Case notes: the same pill bar as the
   Projects hierarchy (docs/typography.md, three-part progress bar), with a
   single "finished" segment. */
.case-notes__progress {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 32rem;
  margin: 0.25rem 0 0.35rem;
}

.case-notes__bar {
  flex: 1;
  display: flex;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.case-notes__bar-done {
  display: block;
  height: 100%;
  background: var(--badge-solution-text);
}

.case-notes__percent {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.case-notes__table {
  box-shadow: none;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.case-notes__table .case-notes__num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.case-notes__start,
.case-notes__run,
.case-notes__rating,
.case-notes__pilot-swap {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.case-notes__start {
  margin-top: 0.5rem;
}

.case-notes__cap {
  align-items: center;
  display: inline-flex;
  gap: 0.35rem;
}

.case-notes__cap-input {
  width: 6rem;
}

.case-notes__ref-input {
  width: 13rem;
}

.case-notes__pilot-head {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.case-notes__pilot-body {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 0.75rem 0;
}

.case-notes__read summary {
  cursor: pointer;
  font-weight: 600;
}

.case-notes__conversation {
  margin-top: 0.5rem;
  max-height: 28rem;
  overflow: auto;
  width: auto;
}

.case-notes__comment {
  flex: 1 1 18rem;
}

@media (max-width: 900px) {
  .case-notes__pilot-body {
    grid-template-columns: 1fr;
  }

  .case-notes__pilot-head {
    flex-direction: column;
  }
}

.workspace-sla__group {
  margin-bottom: 1.5rem;
}

.workspace-sla__group:last-child {
  margin-bottom: 0;
}

.workspace-sla__title {
  font-size: 1rem;
  margin: 0 0 0.35rem;
}

.workspace-sla .ticket-details-field__hint {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.workspace-sla__table {
  border-collapse: collapse;
  margin-top: 0.6rem;
}

.workspace-sla__table th,
.workspace-sla__table td {
  padding: 0.3rem 1rem 0.3rem 0;
  text-align: left;
  vertical-align: middle;
}

.workspace-sla__table thead th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.workspace-sla__priority {
  font-weight: 500;
  white-space: nowrap;
}

.workspace-sla__duration {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.workspace-sla__amount {
  padding: 0.3rem 0.5rem;
  width: 5.5rem;
}

.workspace-sla__unit {
  padding: 0.3rem 0.5rem;
  /* Sized for the longest unit label ("Minutes") so Hours/Days match. */
  width: 7.5rem;
  min-width: 7.5rem;
}

.workspace-sla__duration .custom-select {
  width: 7.5rem;
  min-width: 7.5rem;
  flex: 0 0 7.5rem;
}

.workspace-sla__duration .custom-select__trigger {
  width: 100%;
}

.workspace-sla__days {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.workspace-sla__day {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.workspace-sla__day-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.workspace-sla__day-name {
  display: inline-block;
  min-width: 6rem;
}

.workspace-sla__day-times {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.workspace-sla__day-separator {
  color: var(--muted);
}

.workspace-sla__time {
  padding: 0.3rem 0.5rem;
  width: 8rem;
}

.workspace-sla__holidays {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.6rem 0;
}

.workspace-sla__holiday {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.workspace-sla__holiday-name {
  padding: 0.3rem 0.5rem;
  width: 16rem;
}

.workspace-sla__holiday-date {
  padding: 0.3rem 0.5rem;
  width: 11rem;
}

.workspace-sla__holiday-remove {
  color: var(--muted);
}

.workspace-sla__holiday-remove:hover {
  color: var(--danger-text);
}

.workspace-sla__holiday-list {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
}

.workspace-ticket-rules__group {
  margin-bottom: 1.5rem;
}

.workspace-ticket-rules__group:last-child {
  margin-bottom: 0;
}

.workspace-ticket-rules__title {
  font-size: 1rem;
  margin: 0 0 0.35rem;
}

.workspace-ticket-rules .ticket-details-field__hint {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.workspace-ticket-rules__options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.workspace-ticket-rules__option {
  align-items: center;
  display: inline-flex;
  gap: 0.4rem;
  width: fit-content;
}

label.workspace-ticket-rules__option {
  cursor: pointer;
}

/* Behavior switches (reopen on reply) follow the requirement checkboxes,
   separated by a hairline, with their hint aligned to the label text. */
.workspace-ticket-rules__options--behavior {
  border-top: 1px solid var(--border);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
}

.workspace-ticket-rules .workspace-ticket-rules__option-hint {
  margin: 0.15rem 0 0 1.4rem;
  max-width: 40rem;
}

.workspace-ticket-rules__state {
  color: var(--muted);
}

.form__field--message-editor textarea {
  min-height: 10rem;
}

.form__actions {
  margin-top: 1.25rem;
}

.button {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.25;
}

.button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.button--primary:disabled:hover,
.button--primary[aria-disabled="true"]:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.button--secondary:disabled:hover,
.button--secondary[aria-disabled="true"]:hover {
  border-color: var(--border);
}

.button--primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

.button--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.button--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.button--secondary:hover {
  border-color: var(--muted);
}

.button--ghost {
  background: transparent;
  color: var(--text);
  border-color: transparent;
}

.button--ghost:hover {
  background: var(--bg-subtle);
  border-color: var(--border);
}

.button--icon-only {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  width: 2.1rem;
}

.button--icon-only svg {
  display: block;
}

.button--icon-only.button--sm {
  padding: 0;
}

.button--sm {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--tickets-compact-control-height);
  min-height: var(--tickets-compact-control-height);
  padding: 0.15rem 0.72rem;
  font-size: 0.85rem;
  line-height: 1.15;
}

.link-back {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}

.link-back:hover {
  color: var(--primary);
}

.auth-card {
  max-width: 22rem;
  width: 100%;
  margin: 0;
  padding: 2rem 1.75rem;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.auth-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.auth-card h1.auth-card__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 2rem;
}

.auth-card__hint {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-card__satisfaction-icon {
  display: block;
  margin: 0 auto;
  width: 72px;
  height: 72px;
}

.auth-card__warning {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.auth-card__warning code {
  font-size: 0.85em;
}

/* Duo is the primary action on the sign-in card, so it spans the full width. */
.auth-card__sso-button {
  display: block;
  width: 100%;
  text-align: center;
}

.auth-card .form .form__actions {
  display: flex;
  justify-content: flex-end;
}

.auth-card__password-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.auth-card__password-actions__sign-out-form {
  margin: 0;
}

/* Collapsed until Sign in. grid-template-rows animates the field open; the
   clip hides the label and input (and its margin) while the row is 0fr.
   display: grid would override the UA [hidden] rule, so hidden stays none.
   The negative margin keeps a 0-height row from splitting the email field's
   margin-bottom and the actions' margin-top, which would otherwise pop the
   card 1rem taller before the expand starts. */
.sign-in-password {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: -1rem;
  opacity: 0;
  transition:
    grid-template-rows 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    margin-top 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 240ms ease;
}

.sign-in-password[hidden] {
  display: none;
}

.sign-in-password.is-open {
  grid-template-rows: 1fr;
  margin-top: 0;
  opacity: 1;
}

.sign-in-password__clip {
  min-height: 0;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .sign-in-password {
    transition: none;
  }
}

/* Separates Duo from the break-glass / passwordless form when both are shown. */
.auth-card__divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-card__divider::before,
.auth-card__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

code {
  font-size: 0.85em;
  word-break: break-all;
}

.page-head__title-view {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  min-width: 0;
}

.ticket-view-switcher {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.ticket-view-switcher__label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: var(--muted);
}

/* Control row (docs/typography.md, "Control row"): a row of labelled
   controls with each label ABOVE its control, by request. First used for
   the Projects board's row (Project, Columns, Labels). The label is a small
   muted caption; the controls keep their usual size and line up along their
   bottom edge, so a control that grows (a chip box wrapping) doesn't push
   the others around. A control's wrapper is either a .ticket-view-switcher
   label (label text + select inside) or any .control-row__field holding a
   <label> and its control. */
.control-row {
  /* Where text starts inside a control: its 1px border plus the 0.45rem
     inner padding the dropdowns use. Captions are indented by the same
     amount so they line up with the text, not the box. */
  --control-text-inset: calc(0.45rem + 1px);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 1rem;
}

/* A .ticket-view-switcher label holds its caption as bare text with the
   select after it, so the caption is indented with text-indent (padding
   would indent the select too); the control resets it below. */
.control-row .ticket-view-switcher__label,
.control-row__field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
}

.control-row .ticket-view-switcher__label {
  text-indent: var(--control-text-inset);
}

.control-row__field > label,
.control-row__field > .control-row__caption {
  font: inherit;
  color: inherit;
  padding-left: var(--control-text-inset);
}

/* Module-size controls, all one height, so the captions above line up. */
.control-row .ticket-view-switcher .custom-select__trigger,
.control-row .ticket-view-switcher .ticket-view-switcher__select {
  box-sizing: border-box;
  height: var(--module-control-height);
}

/* Joined text buttons for a choice made by clicking (Descriptions: All |
   None): module height, the pressed one tinted like the layout switch's "on"
   option. Their text starts 0.6rem in, so the field's caption moves to match. */
.control-row__field:has(> .control-row__segmented) {
  --control-text-inset: calc(0.6rem + 1px);
}

.control-row__segmented {
  display: inline-flex;
}

.control-row__segmented > .button {
  box-sizing: border-box;
  height: var(--module-control-height);
  padding: 0 0.6rem;
}

.control-row__segmented > .button:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.control-row__segmented > .button + .button {
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.control-row__segmented > .button[aria-pressed="true"] {
  color: var(--badge-solution-text);
  background: color-mix(in srgb, var(--badge-solution-text) 12%, var(--surface));
  position: relative;
  z-index: 1;
}

/* White (--surface) fields, like the page head's toolbar controls. */
.control-row .custom-select {
  --custom-select-bg: var(--surface);
}

/* A labels chip box in a control row: the row's height with one line of
   chips (grows only if chips wrap; the row lines controls up by their
   bottom edge), white with tinted chips (the Watchers look, not the drawer
   tint), and content starting at the row's text inset so the caption lines
   up with the first chip or the placeholder. */
.control-row .label-chips {
  flex: 1 1 auto;
  box-sizing: border-box;
  min-height: var(--module-control-height);
  padding: 0 0.4rem 0 calc(var(--control-text-inset) - 1px);
  background: var(--surface);
}

.control-row .label-chips .recipient-chips__chip {
  padding-top: 0;
  padding-bottom: 0;
  background: var(--bg);
}

.control-row .label-chips .recipient-chips__input {
  min-width: 6rem;
  padding-left: 0 !important;
}

/* The caption style is for the label only; the control inside keeps the
   normal control text. */
.control-row .ticket-view-switcher__label > *,
.control-row__field > :not(label):not(.control-row__caption) {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: normal;
  color: var(--text);
  text-indent: 0;
}

.ticket-view-switcher__select {
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  min-width: 12rem;
  max-width: min(20rem, 100%);
}

/* On table-parity pages the enhanced view switcher must match the compact
   quick-search input (#ticket_query / .ticket-details-field__input) height and
   font, not the taller default custom-select trigger. */
.ticket-view-switcher .custom-select__trigger {
  padding: 0.15rem 0.45rem;
  font-size: 0.95rem;
  line-height: 1.15;
}

/* Match the quick-search input's footprint so a long saved view name cannot
   widen the control and crowd the page head. Scoped to the switcher form so the
   dashboard widget filters that reuse .ticket-view-switcher__select on its own
   keep sizing to their own content. */
.ticket-view-switcher .ticket-view-switcher__select {
  box-sizing: border-box;
  width: var(--index-control-width, 12rem);
  min-width: 0;
  max-width: 100%;
}

/* select-enhancer stamps an inline min-width sampled from the native select, so
   !important is needed to keep the trigger at the shared width. */
.ticket-view-switcher .custom-select {
  width: var(--index-control-width, 12rem);
  min-width: 0 !important;
  max-width: 100%;
}

/* Flex items default to min-width: auto, which would let a long label push the
   caret out instead of ellipsizing. */
.ticket-view-switcher .custom-select__current {
  min-width: 0;
}

/* ── Generic rounded custom-select dropdown ───────────────────────────────── */

.custom-select {
  /* Background is context-aware: each placement can override --custom-select-bg
     so the control matches the surrounding fields (e.g. var(--bg) in the
     filters drawer, var(--surface) on the page head). */
  --custom-select-bg: var(--surface);
  position: relative;
  display: block;
}

.custom-select__trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--custom-select-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.custom-select__trigger:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--text));
}

.custom-select__trigger:focus-visible {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 1px;
}

.custom-select__current {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select__caret {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.custom-select__list {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--custom-select-bg);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 14%, transparent);
  position: absolute;
  z-index: 200;
  max-height: 18rem;
  overflow-y: auto;
  font-size: 0.95rem;
}

/* Searchable selects (data-searchable): a filter box pinned to the top of
   the open list while the options (about 10 rows, enhanced_select_controller
   caps it) scroll under it; "No matches" when the filter hides them all. */
.custom-select__list--searchable {
  padding-top: 0;
}

.custom-select__list > li[hidden] {
  display: none;
}

.custom-select__search {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.25rem 0 0.3rem;
  background: var(--custom-select-bg);
}

.custom-select__search-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.custom-select__empty {
  padding: 0.4rem 0.45rem;
  font-size: 0.85rem;
}

/* Filters drawer: match the surrounding text inputs / comboboxes (var(--bg)). */
.ticket-filter-fields .custom-select {
  --custom-select-bg: var(--bg);
}

/* Bulk edit drawer: stretch every control to fill the value column so selects,
   pickers, typeaheads, and plain inputs share one width. */
.bulk-edit-tickets-drawer__form .ticket-details-field__value > .ticket-details-field__control,
.bulk-edit-tickets-drawer__form .ticket-details-field__value > .suggest-input,
.bulk-edit-tickets-drawer__form .ticket-details-field__value > .custom-select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Enhanced selects need display and an override for the per-select inline
   min-width the enhancer applies. */
.bulk-edit-tickets-drawer__form .ticket-details-field__value > .custom-select {
  display: block;
  min-width: 0 !important;
}

/* Shares the Scenarios title row; wraps below the title only when the sidebar
   is too narrow for both. */
.ticket-scenarios__enact-row {
  flex: 1 1 12rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
}

/* In the scenarios sidebar the enhanced select should grow to fill the row so
   it and the "Go" button consume the full available width. Override the
   per-select inline min-width the enhancer applies. */
.ticket-scenarios__enact-row .custom-select {
  flex: 1 1 auto;
  min-width: 0 !important;
}

.ticket-scenarios__enact-row .custom-select__trigger {
  width: 100%;
  height: var(--tickets-compact-control-height);
  padding-block: 0;
  font-size: 0.85rem;
}

.custom-select__option {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 0.4rem 0.45rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.custom-select__option:hover,
.custom-select__option:focus-visible {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  outline: none;
}

.custom-select__option--selected {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

/* Non-selectable items (optgroup labels via the enhancer, or disabled options
   like the view switcher's "Custom filters (see Filters…)"). */
.custom-select__group {
  padding: 0.4rem 0.45rem 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.custom-select__option--disabled,
.custom-select__option[aria-disabled="true"] {
  color: var(--muted);
  cursor: default;
  font-style: italic;
}

.custom-select__option--disabled:hover,
.custom-select__option[aria-disabled="true"]:hover {
  background: transparent;
}

/* Native <select> kept in the DOM for submission + change events while the
   custom trigger/listbox is shown. Visually hidden but still rendered so its
   computed background can be sampled and it continues to submit. */
.custom-select__native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  pointer-events: none;
}

.filter-form--tickets-index {
  align-items: center;
  /* Keep count / pagination off the viewport and scroll edges */
  padding-inline-end: max(0.75rem, env(safe-area-inset-right, 0px));
  min-width: 0;
}

.filter-form--tickets-index .filter-form__count {
  display: inline-flex;
  align-items: center;
  line-height: 1.25;
  /* Extra separation from trailing pagination / edge when section padding is tight */
  margin-inline-end: 0.35rem;
}

.filter-form__pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.9rem;
}

.ticket-filters-dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  max-width: 40rem;
  width: calc(100% - 2rem);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.ticket-filters-dialog--wide {
  max-width: 56rem;
}

.ticket-filters-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.ticket-filters-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.ticket-filters-dialog__header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.ticket-filters-dialog__title {
  margin: 0;
  font-size: 1.15rem;
}

.ticket-filters-dialog__hint {
  margin: 0;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.ticket-filter-fields {
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ticket-filter-fields__row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  align-items: start;
}

.ticket-filter-fields__label {
  display: block;
  margin: 0;
  padding-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.ticket-filter-fields__control {
  min-width: 0;
}

/* Two controls sharing one row, e.g. the Sort by column + direction pair. Both
   the wrapper and the bare select are matched: select-enhancer moves each
   <select> into a .custom-select wrapper once it runs, making the wrapper the
   flex item, and it stamps a sampled inline min-width that has to be overridden.
   The trailing control is the narrow one (direction). */
.ticket-filter-fields__control--split {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ticket-filter-fields__control--split > .custom-select,
.ticket-filter-fields__control--split > select {
  flex: 1 1 0;
  min-width: 0 !important;
}

.ticket-filter-fields__control--split > .custom-select:last-child,
.ticket-filter-fields__control--split > select.ticket-filter-fields__sort-direction {
  flex: 0 0 8rem;
}

/* Tick-box choice list in a Filters drawer (shared/filter_checks_row). */
.ticket-filter-fields__checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0;
  padding: 0.35rem 0 0;
  border: 0;
}

.ticket-filter-fields__check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
}

.ticket-filter-fields__multi {
  width: 100%;
  min-height: 6rem;
  padding: 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.ticket-filter-fields select:not([multiple]) {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  max-width: 100%;
}

.ticket-filters-dialog__actions {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Confirm dialog footer: right-aligned compact buttons matching the
   control-shape-height-colors contract. Scoped via the --confirm modifier so
   the saved-view filter drawer footer keeps its existing column layout. */
.ticket-filters-dialog__actions--confirm {
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem 1rem;
}

.ticket-filters-dialog__actions--confirm .button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--tickets-compact-control-height, 24px);
  min-height: var(--tickets-compact-control-height, 24px);
  padding: 0.15rem 0.72rem;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.15;
}

/* Restore UA [hidden] semantics overridden by display: inline-flex above. */
.ticket-filters-dialog__actions--confirm .button[hidden] {
  display: none;
}

/* Confirm dialog extras: impact list and typed confirmation (askTyped). */
.confirm-dialog__details {
  margin: 0;
  padding: 0 1.25rem 0.75rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text);
}

.confirm-dialog__typed {
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.confirm-dialog__details[hidden],
.confirm-dialog__typed[hidden] {
  display: none;
}

.confirm-dialog__typed-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.confirm-dialog__typed-label strong {
  color: var(--text);
  font-family: var(--font-mono, ui-monospace, monospace);
}

.confirm-dialog__typed-input {
  width: 100%;
  box-sizing: border-box;
}

.confirm-dialog__typed-input + .confirm-dialog__typed-label {
  margin-top: 0.5rem;
}

#app-confirm-dialog:has(.confirm-dialog__details:not([hidden])) {
  max-width: 36rem;
}

/* Ticket-group reassignment confirm dialog: keep replacement controls aligned
   with hint text and avoid edge-to-edge select width in the modal. */
.ticket-group-reassign__field {
  margin: 0.15rem 0 0;
  padding: 0 1.25rem;
}

.ticket-group-reassign__label {
  display: block;
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.ticket-group-reassign__select {
  width: min(22rem, 100%);
}

/* Confirm-only overrides: narrower modal and no internal divider lines.
   Scoped to #app-confirm-dialog so the shared ticket-filters dialog used by
   the saved-views editor keeps its original width and borders. */
#app-confirm-dialog {
  max-width: 28rem;
}

#app-confirm-dialog .ticket-filters-dialog__header {
  border-bottom: 0;
}

#app-confirm-dialog .ticket-filters-dialog__actions {
  border-top: 0;
}

.ticket-filters-dialog__save {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
}

.ticket-filters-dialog__save-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  min-width: 12rem;
  flex: 1;
}

.ticket-filters-dialog__name-input {
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.ticket-filters-dialog__save .button_to {
  display: inline;
}

.ticket-filters-dialog__save .button_to > form {
  display: inline;
  margin: 0;
}

/* Tickets index: filters drawer (right fly-in, turbo frame) */
.ticket-filters-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
}

.ticket-filters-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.ticket-filters-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.ticket-filters-drawer--open .ticket-filters-drawer__backdrop {
  opacity: 1;
}

.ticket-filters-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.ticket-filters-drawer--open .ticket-filters-drawer__panel {
  transform: translateX(0);
}

.ticket-filters-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.ticket-filters-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ticket-filters-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.ticket-filters-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.ticket-filters-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

.ticket-filters-drawer__hint {
  flex-shrink: 0;
}

.ticket-filters-drawer__save-actions {
  border-top: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 0 1rem;
  margin-bottom: 1rem;
}

.ticket-filters-drawer__save {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0.5rem 0.75rem;
  align-items: start;
}

.ticket-filters-drawer__save .ticket-filters-dialog__save-label {
  display: block;
  margin: 0;
  padding-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 0;
  flex: none;
}

.ticket-filters-drawer__save .ticket-filters-dialog__name-input {
  width: 100%;
}

.ticket-filters-drawer__save-buttons {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

/* Drawer inner already has horizontal padding; drop duplicate inset so field rows align with save row. */
.ticket-filters-drawer__inner .ticket-filter-fields {
  padding-left: 0;
  padding-right: 0;
}

.ticket-filters-drawer__footer-actions {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 0.5rem;
}

.merge-tickets-drawer__hint,
.bulk-edit-tickets-drawer__hint {
  margin-bottom: 1rem;
}

.merge-tickets-drawer__form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.merge-tickets-drawer__list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.merge-tickets-drawer__choice {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

/* The radio and its spacer in search results share one fixed width so the
   selected-ticket cards and the search-result cards line up. */
.merge-tickets-drawer__radio,
.merge-tickets-drawer__radio-spacer {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0.25rem 0 0;
}

.merge-tickets-drawer__choice-content {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0.55rem 0.7rem;
}

.merge-tickets-drawer__radio:checked + .merge-tickets-drawer__choice-content {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.merge-tickets-drawer__choice-heading {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.merge-tickets-drawer__choice-heading .ticket-activity-badge {
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: normal;
}

.ticket-status-badge {
  flex-shrink: 0;
  white-space: nowrap;
}

.ticket-status-badge--colored {
  background: color-mix(in srgb, var(--ticket-status-badge-color) 22%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ticket-status-badge-color) 55%, var(--border));
  color: var(--text);
}

.merge-tickets-drawer__choice-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.merge-tickets-drawer__panel {
  width: var(--drawer-width-medium);
  max-width: var(--drawer-width-medium);
}

.merge-tickets-drawer__hint--notice {
  color: var(--muted);
  font-weight: 600;
}

.merge-tickets-drawer__row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.merge-tickets-drawer__row > .merge-tickets-drawer__choice {
  flex: 1 1 auto;
  min-width: 0;
}

/* Remove and + Add differ in label width; a shared fixed width keeps the cards
   in both lists the same width. */
.merge-tickets-drawer__row-action,
.merge-tickets-drawer__row-action-spacer {
  flex-shrink: 0;
  width: 5.5rem;
  text-align: center;
  white-space: nowrap;
}

.merge-tickets-drawer__search {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.merge-tickets-drawer__search-title {
  margin: 0;
  font-size: 1rem;
}

.merge-tickets-drawer__search-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.merge-tickets-drawer__search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}

.merge-tickets-drawer__search-form > .ticket-details-field__input {
  flex: 1 1 12rem;
  width: auto;
  min-width: 0;
  max-width: 24rem;
}

.merge-tickets-drawer__result-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0 0 0.6rem;
  padding: 0;
  list-style: none;
}

.merge-tickets-drawer__result {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.merge-tickets-drawer__result > .merge-tickets-drawer__choice-content {
  flex: 1 1 auto;
  min-width: 0;
}

/* Requester profiles: edit fly-in from the right */
.requester-profile-drawer,
.portal-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
}

.requester-profile-drawer--open,
.portal-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.requester-profile-drawer__backdrop,
.portal-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.requester-profile-drawer--open .requester-profile-drawer__backdrop,
.portal-drawer--open .portal-drawer__backdrop {
  opacity: 1;
}

/* Swapping the requester summary for another person's (manager link): stay
   visible with the page dimmed while the old panel slides out and the next one
   loads, instead of vanishing (requester_summary_drawer_controller.js). */
.requester-profile-drawer--swapping {
  visibility: visible;
}

.requester-profile-drawer--swapping .requester-profile-drawer__backdrop {
  opacity: 1;
}

.requester-profile-drawer__panel,
.portal-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out, width 220ms ease-out, max-width 220ms ease-out;
}

.portal-drawer__panel:has(.portal-drawer__inner--conversation) {
  width: var(--drawer-width-large);
  max-width: var(--drawer-width-large);
}

.requester-profile-drawer--open .requester-profile-drawer__panel,
.portal-drawer--open .portal-drawer__panel {
  transform: translateX(0);
}

.requester-profile-drawer__panel turbo-frame,
.portal-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.requester-profile-drawer__inner,
.portal-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.portal-drawer__inner--conversation {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.portal-drawer__inner--conversation .portal-drawer__head,
.portal-drawer__inner--conversation .portal-drawer__note {
  flex: 0 0 auto;
}

.requester-profile-drawer__head,
.portal-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.requester-profile-drawer__head-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.requester-profile-drawer__head-actions,
.portal-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.requester-profile-drawer__title,
.portal-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

.requester-profile-drawer__title .ticket-table__cell-link {
  font: inherit;
  cursor: pointer;
}

/* Read-only requester summary drawer (tickets index "From" column) */
.requester-summary-drawer__profile {
  margin-bottom: 1.25rem;
}

.requester-summary-drawer__manager {
  gap: 0.4rem;
}

/* Name and title share a baseline; the photo stays centered on the row. */
.requester-summary-drawer__manager-name {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.4rem;
  min-width: 0;
}

.requester-summary-drawer__manager-title {
  color: var(--muted);
  font-size: 0.85rem;
}

.requester-summary-drawer__section {
  margin-bottom: 1.5rem;
}

.requester-summary-drawer__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.requester-summary-drawer__section-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.requester-summary-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.requester-summary-drawer__list-item + .requester-summary-drawer__list-item {
  border-top: 1px solid var(--border);
}

.requester-summary-drawer__list-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.requester-summary-drawer__list-link:hover {
  background: var(--surface);
}

.requester-summary-drawer__list-item-static {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.75rem;
  color: var(--text);
}

.requester-summary-drawer__list-primary {
  font-size: 0.9rem;
  line-height: 1.3;
}

.requester-summary-drawer__list-id {
  color: var(--muted);
  margin-right: 0.4rem;
}

.requester-summary-drawer__list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.requester-summary-drawer__empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Assets: edit fly-in from the right (same layout as requester profile drawer) */
.asset-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
}

.asset-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.asset-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.asset-drawer--open .asset-drawer__backdrop {
  opacity: 1;
}

.asset-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out, width 220ms ease-out, max-width 220ms ease-out;
}

.asset-drawer__panel:has(.asset-drawer__inner--large) {
  width: var(--drawer-width-large);
  max-width: var(--drawer-width-large);
}

.asset-drawer--open .asset-drawer__panel {
  transform: translateX(0);
}

.asset-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.asset-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
}

.asset-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.asset-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.asset-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

.asset-s1-collision {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--color-danger, #b42318);
  background: var(--color-danger-bg, color-mix(in srgb, #b42318 8%, transparent));
  font-size: 0.875rem;
  line-height: 1.4;
}

.asset-s1-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.asset-s1-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.asset-s1-section__title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.asset-s1-section__head .asset-s1-section__title {
  margin-bottom: 0;
}

.asset-s1-section__title--filtered {
  color: var(--link, #2563eb);
}

.asset-s1-section__title--filtered .asset-s1-section__meta {
  color: inherit;
}

.asset-s1-section__meta {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted, #667085);
}

.asset-s1-apps-search {
  position: relative;
  flex: 0 0 auto;
  width: 11rem;
  align-self: center;
}

.asset-s1-apps-search__input {
  box-sizing: border-box;
  width: 100%;
  height: 1.375rem;
  padding: 0 1.25rem 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1.2;
}

.asset-s1-apps-search__input[type="search"]::-webkit-search-decoration,
.asset-s1-apps-search__input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.asset-s1-apps-search__input::placeholder {
  color: var(--muted);
}

.asset-s1-apps-search__clear {
  position: absolute;
  top: 50%;
  right: 0.2rem;
  z-index: 1;
  display: none;
  width: 0.95rem;
  height: 0.95rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}

.asset-s1-apps-search__input:not(:placeholder-shown) ~ .asset-s1-apps-search__clear {
  display: grid;
  place-items: center;
}

.asset-s1-apps-search__clear:hover,
.asset-s1-apps-search__clear:focus-visible {
  color: var(--text);
  background: var(--bg-subtle);
  outline: none;
}

.asset-s1-section__empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted, #667085);
}

.asset-s1-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  margin-bottom: 0.5rem;
}

.asset-s1-grid .ticket-details-field {
  margin-bottom: 0;
}

.asset-s1-apps-wrap {
  overflow-x: auto;
  max-height: 22rem;
  overflow-y: auto;
  border: 1px solid var(--border);
}

/* Installed applications: short scroll area so the S1 column stays compact. */
.asset-s1-apps-wrap--short {
  max-height: 18rem;
}

.asset-s1-apps-wrap--nics {
  max-height: 12rem;
}

.asset-s1-apps {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.asset-s1-apps th,
.asset-s1-apps td {
  padding: 0.4rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.asset-s1-apps th {
  position: sticky;
  top: 0;
  background: var(--surface, #fff);
  font-weight: 600;
  z-index: 1;
}

.asset-s1-apps tbody tr:last-child td {
  border-bottom: 0;
}

.asset-s1-apps__no-match td {
  padding: 0.75rem;
  color: var(--muted, #667085);
  text-align: center;
}

/* Assets: wide S1 split (Alfred cols 1–2, S1 cols 3–4) */
.asset-drawer-split {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.asset-pair-row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) 9rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.25rem 0;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.asset-pair-row > *:nth-child(1) {
  grid-column: 1;
  min-width: 0;
}

.asset-pair-row > *:nth-child(2) {
  grid-column: 2;
  min-width: 0;
}

.asset-pair-row > *:nth-child(3) {
  grid-column: 3;
  min-width: 0;
}

.asset-pair-row > *:nth-child(4) {
  grid-column: 4;
  min-width: 0;
}

.asset-pair-row--s1-only > *:nth-child(1) {
  grid-column: 3;
}

.asset-pair-row--s1-only > *:nth-child(2) {
  grid-column: 4;
}

.asset-pair-row--section-head {
  align-items: baseline;
  border-bottom: 0;
  margin-bottom: 0.25rem;
  padding-bottom: 0.5rem;
}

.asset-pair-row--section-head > .asset-pair-row__alfred-head {
  grid-column: 1 / 3;
}

.asset-pair-row--section-head > .asset-pair-row__s1-head {
  grid-column: 3 / -1;
}

.asset-pair-row__alfred-head,
.asset-pair-row__s1-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.asset-pair-row__s1-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.asset-pair-row--full > *:nth-child(1) {
  grid-column: 1;
}

.asset-pair-row--full > *:nth-child(2) {
  grid-column: 2 / -1;
}

.asset-pair-row--description {
  align-items: start;
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

/* Bottom panels: Asset history (left half) beside the S1 tables (right half),
   both starting level with the last S1 field row. */
.asset-pair-row--panels {
  align-items: start;
  min-height: 0;
  padding: 0;
  border-bottom: 0;
}

.asset-drawer-split__panel {
  min-width: 0;
}

.asset-pair-row--panels > .asset-drawer-split__panel--alfred {
  grid-column: 1 / 3;
}

.asset-pair-row--panels > .asset-drawer-split__panel--s1 {
  grid-column: 3 / -1;
}

/* Panel sections rely on their own headings for separation, so no top rules:
   the leading one would double the last field row's border. */
.asset-pair-row--panels .asset-drawer-split__panel > * {
  border-top: 0;
  padding-top: 0;
}

/* Asset history: same section chrome as the S1 tables, with its own scroll so a
   long history does not stretch the drawer. No top rule; the preceding field row
   already draws one. */
.asset-history {
  margin-top: 1.25rem;
}

.asset-history__title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.asset-history__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 22rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.asset-pair-row .ticket-details-field__input,
.asset-pair-row .ticket-details-field__control,
.asset-pair-row .suggest-input,
.asset-pair-row .custom-select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.asset-pair-row .ticket-details-field__value {
  width: 100%;
}

.asset-pair-row .ticket-details-field__value > .ticket-details-field__control,
.asset-pair-row .ticket-details-field__value > .custom-select,
.asset-pair-row .ticket-details-field__value > .suggest-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

@media (max-width: 1100px) {
  .asset-pair-row {
    grid-template-columns: 9rem minmax(0, 1fr);
  }

  .asset-pair-row > *:nth-child(1),
  .asset-pair-row > *:nth-child(2),
  .asset-pair-row > *:nth-child(3),
  .asset-pair-row > *:nth-child(4),
  .asset-pair-row--s1-only > *:nth-child(1),
  .asset-pair-row--s1-only > *:nth-child(2),
  .asset-pair-row--section-head > .asset-pair-row__alfred-head,
  .asset-pair-row--section-head > .asset-pair-row__s1-head,
  .asset-pair-row--full > *:nth-child(1),
  .asset-pair-row--full > *:nth-child(2) {
    grid-column: auto;
  }

  .asset-pair-row--section-head > .asset-pair-row__alfred-head,
  .asset-pair-row--section-head > .asset-pair-row__s1-head {
    grid-column: 1 / -1;
  }

  .asset-pair-row--full > *:nth-child(1) {
    grid-column: 1;
  }

  .asset-pair-row--full > *:nth-child(2) {
    grid-column: 2;
  }

  .asset-pair-row--panels > .asset-drawer-split__panel--alfred,
  .asset-pair-row--panels > .asset-drawer-split__panel--s1 {
    grid-column: 1 / -1;
  }
}

/* ---- Export / Import drawer ---- */
.data-transfer-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
}

.data-transfer-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.data-transfer-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.data-transfer-drawer--open .data-transfer-drawer__backdrop {
  opacity: 1;
}

.data-transfer-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.data-transfer-drawer--open .data-transfer-drawer__panel {
  transform: translateX(0);
}

.data-transfer-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.data-transfer-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
}

.data-transfer-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.data-transfer-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.data-transfer-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

.data-transfer-drawer__action-row {
  margin-top: 1.25rem;
}

.data-transfer-drawer__choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: normal;
}

.data-transfer-drawer .ticket-details-field__hint {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

#data-transfer-import-results {
  display: block;
}

.data-transfer-drawer__import-progress {
  margin-top: 1rem;
}

.data-transfer-drawer__import-progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.data-transfer-drawer__import-progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.15s ease;
  min-width: 2px;
}

.data-transfer-drawer__import-progress-text {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.data-transfer-drawer__import-result {
  margin-top: 1rem;
}

.data-transfer-drawer__import-result--success {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: var(--notice-bg);
  color: var(--notice-text);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.data-transfer-drawer__import-result--success p {
  margin: 0;
  font-weight: 500;
}

.data-transfer-drawer__import-result--success ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.data-transfer-drawer__import-result--error {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--border);
}

.data-transfer-drawer__import-result--error p {
  margin: 0;
}

.data-transfer-drawer__import-result--error p:first-child {
  font-weight: 500;
}

.data-transfer-drawer__import-result--error p + p {
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

.data-transfer-drawer__import-result details summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--muted);
}

.data-transfer-drawer__import-result details > div {
  margin-top: 0.5rem;
  max-height: 18rem;
  overflow-y: auto;
}

.data-transfer-drawer__import-result table {
  width: 100%;
  font-size: 0.8rem;
  border-collapse: collapse;
}

.data-transfer-drawer__import-result table thead tr {
  border-bottom: 1px solid var(--border);
}

.data-transfer-drawer__import-result table th {
  text-align: left;
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
}

.data-transfer-drawer__import-result table tbody tr {
  border-bottom: 1px solid var(--border);
}

.data-transfer-drawer__import-result table td {
  padding: 0.25rem 0.5rem;
}

.data-transfer-drawer__import-result table td:first-child {
  white-space: nowrap;
  color: var(--muted);
}

/* Global admin users: edit drawer (same layout as requester profile drawer) */
.global-admin-user-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
}

.global-admin-user-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.global-admin-user-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.global-admin-user-drawer--open .global-admin-user-drawer__backdrop {
  opacity: 1;
}

.global-admin-user-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-medium);
  max-width: var(--drawer-width-medium);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.global-admin-user-drawer--open .global-admin-user-drawer__panel {
  transform: translateX(0);
}

.global-admin-user-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.global-admin-user-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.global-admin-user-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.global-admin-user-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.global-admin-user-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

/* Global admin role definitions: edit drawer (same layout as requester profile drawer) */
.role-definition-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
}

.role-definition-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.role-definition-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.role-definition-drawer--open .role-definition-drawer__backdrop {
  opacity: 1;
}

.role-definition-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.role-definition-drawer--open .role-definition-drawer__panel {
  transform: translateX(0);
}

.role-definition-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.role-definition-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.role-definition-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.role-definition-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.role-definition-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

/* Admin user permissions: edit drawer (mirrors requester / role-definition drawer behavior) */
.permissions-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
}

.permissions-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.permissions-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.permissions-drawer--open .permissions-drawer__backdrop {
  opacity: 1;
}

.permissions-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-medium);
  max-width: var(--drawer-width-medium);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.permissions-drawer--open .permissions-drawer__panel {
  transform: translateX(0);
}

.permissions-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.permissions-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.permissions-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.permissions-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.permissions-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

.permissions-drawer__subsection-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.permissions-drawer__title-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

/* Names the header-selected workspace so admins can't edit the wrong one. */
.permissions-drawer__workspace {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.permissions-drawer__workspace strong {
  color: var(--text);
  font-weight: 600;
}

.permissions-drawer__section {
  margin-bottom: 1.25rem;
}

.permissions-drawer .ticket-details-field__hint {
  display: block;
  margin: 0;
}

/* Checkbox + description rows (workspace permissions, Allow data import). */
.permissions-drawer__check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  font-weight: normal;
}

/* Module rows grow when they show ticket groups or data import; keep the
   module name level with its access switch instead of centred in the row. */
.permissions-drawer__module-row {
  align-items: start;
}

.permissions-drawer__module-row > .ticket-details-field__label {
  display: flex;
  flex-direction: column;
}

.permissions-drawer__module-name {
  display: flex;
  align-items: center;
  min-height: calc(var(--tickets-compact-control-height, 24px) + 0.3rem);
}

/* Short note under a module name (Tickets: "Limit to groups (optional)"). */
.permissions-drawer__label-hint {
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--muted);
}

.permissions-drawer__label-hint[hidden] {
  display: none;
}

.permissions-drawer__module-control {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.15rem 0;
}

/* Access switch plus, where the module has it, the data import checkbox. */
.permissions-drawer__access-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
}

.permissions-drawer__import {
  align-items: center;
  font-size: 0.9rem;
  white-space: nowrap;
}

.permissions-drawer__import input {
  margin: 0;
}

.permissions-drawer__inline-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Extra options under a module (ticket group limits, data import). */
.permissions-drawer__subpanel {
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border);
}

.permissions-drawer__subpanel[hidden] {
  display: none;
}

.permissions-drawer__new-user {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.permissions-drawer__new-user-toggle {
  cursor: pointer;
  color: var(--muted);
}

.permissions-drawer__new-user[open] > .permissions-drawer__new-user-toggle {
  margin-bottom: 0.25rem;
}

/* Segmented control: one choice from a few joined options, built on a radio
   group so the form, keyboard arrows and screen readers work as normal.
   Markup: .segmented-control[role=radiogroup] > (input.segmented-control__input
   + label.segmented-control__option[for]) per option. Action size (24px). */
.segmented-control {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.segmented-control__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.segmented-control__option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--tickets-compact-control-height, 24px) - 2px);
  margin: 0;
  padding: 0 0.75rem;
  font-size: 0.85rem;
  font-weight: normal;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.segmented-control__option:not(:first-of-type) {
  border-left: 1px solid var(--border);
}

.segmented-control__option:first-of-type {
  border-radius: 5px 0 0 5px;
}

.segmented-control__option:last-of-type {
  border-radius: 0 5px 5px 0;
}

.segmented-control__input:not(:disabled):not(:checked) + .segmented-control__option:hover {
  background: var(--bg-subtle);
}

.segmented-control__input:checked + .segmented-control__option {
  background: var(--primary);
  color: var(--on-primary);
}

.segmented-control__input:focus-visible + .segmented-control__option {
  z-index: 1;
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.segmented-control__input:disabled + .segmented-control__option {
  color: var(--muted);
  cursor: not-allowed;
}

.segmented-control__input:disabled:checked + .segmented-control__option {
  background: color-mix(in srgb, var(--primary) 55%, transparent);
  color: var(--on-primary);
}

/* Keep drawer form controls aligned to the full value column width. */
.permissions-drawer .ticket-details-field__value > .ticket-details-field__control,
.permissions-drawer .ticket-details-field__value > .custom-select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* User preferences drawer (global header) */
.user-preferences-drawer {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
}

.user-preferences-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.user-preferences-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.user-preferences-drawer--open .user-preferences-drawer__backdrop {
  opacity: 1;
}

.user-preferences-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.user-preferences-drawer--open .user-preferences-drawer__panel {
  transform: translateX(0);
}

.user-preferences-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.user-preferences-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.user-preferences-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.user-preferences-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* Sound notifications bell, left of Log out. Slashed and muted when off. */
.notification-sounds-bell__slot,
.notification-sounds-bell__form {
  display: inline-flex;
}

.notification-sounds-bell {
  color: var(--muted);
}

/* Drawer head buttons are a fixed 24px tall with wide side padding, which
   squeezed the bell to a sliver. Drop the padding so the 18px icon sits
   centred at full size, and stop flex from shrinking it. */
.user-preferences-drawer__head-actions .notification-sounds-bell {
  padding: 0;
}

.notification-sounds-bell svg {
  flex-shrink: 0;
}

.notification-sounds-bell--on {
  color: var(--primary);
  border-color: var(--primary);
}

.user-preferences-sound {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-preferences-sound .ticket-details-field__input {
  flex: 1 1 auto;
  min-width: 0;
}

.user-preferences-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

/* User preferences form: two-column label/control rows (table-edit drawer pattern). */
.user-preferences-form {
  max-width: none;
}

.user-preferences-form__rows {
  display: flex;
  flex-direction: column;
}

.user-preferences-form .ticket-details-field {
  align-items: start;
  min-height: 0;
  padding: 0.55rem 0;
}

.user-preferences-form .ticket-details-field[hidden] {
  display: none;
}

.user-preferences-form .ticket-details-field > .ticket-details-field__label {
  padding-top: 0.4rem;
  font-weight: 500;
  color: var(--text);
}

.user-preferences-form .user-preferences-field__stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  width: 100%;
  min-width: 0;
}

.user-preferences-form .user-preferences-field__stack > .form__radio-row {
  margin-top: 0;
}

.user-preferences-form .user-preferences-field__stack > .form__hint {
  margin-top: 0;
}

.user-preferences-form .ticket-details-field__value > .theme-color-picker,
.user-preferences-form .ticket-details-field__value > .ticket-details-field__input {
  width: 100%;
}

/* Initials stay compact; color picker fills the remaining row width. */
.user-preferences-form .avatar-field__controls-row > .ticket-details-field__input {
  width: auto;
}

.user-preferences-form .avatar-field__controls-row > .avatar-field__color {
  flex: 1 1 0;
  min-width: 0;
}

/* Vertically center the avatar badge with the initials/color controls. */
.user-preferences-form .avatar-field-row {
  align-items: center;
}

.user-preferences-form .avatar-field-row > .avatar-field__icon-column {
  align-items: flex-start;
}

.user-preferences-form .ticket-details-field__value > select.ticket-details-field__input {
  background: var(--surface);
}

.user-preferences-form .user-preferences-field-group {
  display: contents;
}

.user-preferences-form .user-preferences-field--full {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.user-preferences-form .user-preferences-field--full__label {
  margin: 0;
  font-weight: 500;
  color: var(--text);
}

.user-preferences-form .user-preferences-field--full__editor {
  width: 100%;
}

@media (max-width: 36rem) {
  .user-preferences-form .ticket-details-field {
    grid-template-columns: 1fr;
    row-gap: 0.35rem;
  }

  .user-preferences-form .ticket-details-field > .ticket-details-field__label {
    padding-top: 0;
  }
}

/* Role definition form: Permissions legend in column 1, checkboxes in column 2 (drawer + full-page edit). */
fieldset.ticket-details-field.role-definition-permissions {
  min-width: 0;
}

fieldset.ticket-details-field.role-definition-permissions > legend.role-definition-permissions__legend {
  grid-column: 1;
  grid-row: 1;
  margin-bottom: 0;
  float: none;
  max-width: 9rem;
}

fieldset.ticket-details-field.role-definition-permissions > .role-definition-permissions__content {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

/* Global admin workspaces / directories: drawers (same layout as requester profile drawer) */
.global-admin-workspace-drawer,
.global-admin-directory-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
}

.global-admin-workspace-drawer--open,
.global-admin-directory-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.global-admin-workspace-drawer__backdrop,
.global-admin-directory-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.global-admin-workspace-drawer--open .global-admin-workspace-drawer__backdrop,
.global-admin-directory-drawer--open .global-admin-directory-drawer__backdrop {
  opacity: 1;
}

.global-admin-workspace-drawer__panel,
.global-admin-directory-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.global-admin-workspace-drawer__panel {
  width: var(--drawer-width-medium);
  max-width: var(--drawer-width-medium);
}

.global-admin-workspace-drawer--open .global-admin-workspace-drawer__panel,
.global-admin-directory-drawer--open .global-admin-directory-drawer__panel {
  transform: translateX(0);
}

.global-admin-workspace-drawer__panel turbo-frame,
.global-admin-directory-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.global-admin-workspace-drawer__inner,
.global-admin-directory-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.global-admin-workspace-drawer__head,
.global-admin-directory-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.global-admin-workspace-drawer__head-actions,
.global-admin-directory-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.global-admin-workspace-drawer__title,
.global-admin-directory-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

/* Workspace settings: ranked AlfredADSync domains (highest priority first). */
.directory-subscriptions {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.directory-subscriptions:empty {
  display: none;
}

.directory-subscriptions__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.directory-subscriptions__rank {
  flex: 0 0 auto;
  min-width: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.directory-subscriptions__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-subscriptions__actions {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 0.35rem;
}

.directory-subscriptions__actions .button.button--sm {
  height: var(--tickets-compact-control-height, 24px);
  min-height: var(--tickets-compact-control-height, 24px);
  padding: 0.15rem 0.72rem;
  border-radius: 6px;
  line-height: 1.15;
}

.directory-subscriptions__empty {
  margin: 0 0 0.5rem;
  color: var(--muted);
}

.directory-subscriptions__empty[hidden] {
  display: none;
}

/* Canned responses: edit drawer (same layout as requester profile drawer) */
/* Set on document.body while drawer is open so the ticket page does not scroll behind it. */
body.canned-response-drawer-scroll-locked {
  overflow: hidden;
}

.canned-response-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
  overscroll-behavior: contain;
}

/* Task drawer should overlay ticket sticky headers/section heads. */
.agent-task-drawer {
  z-index: 120;
}

.canned-response-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.canned-response-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.canned-response-drawer--open .canned-response-drawer__backdrop {
  opacity: 1;
}

/* Drawer-to-drawer swap (drawer_swap.js): the panel slides out and back in
   while the drawer stays visible and the page stays dimmed. */
.canned-response-drawer--swapping {
  pointer-events: auto;
  visibility: visible;
}

.canned-response-drawer--swapping .canned-response-drawer__backdrop {
  opacity: 1;
}

.canned-response-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.canned-response-drawer--open .canned-response-drawer__panel {
  transform: translateX(0);
}

.canned-response-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.canned-response-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
}

.canned-response-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.canned-response-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.canned-response-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

/* Scheduled task — guided RRULE builder */
.scheduled-ticket-rrule-builder__control {
  grid-column: 2;
  min-width: 0;
}

.scheduled-ticket-rrule-builder__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.25rem;
  margin-top: 0.35rem;
}

.scheduled-ticket-rrule-builder__inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.scheduled-ticket-rrule-builder__inline-label {
  font-size: 0.875rem;
  color: var(--muted);
}

.scheduled-ticket-rrule-builder__interval {
  width: 4.5rem;
  min-width: 0;
}

.scheduled-ticket-rrule-builder__inline-suffix {
  font-size: 0.875rem;
  color: var(--muted);
}

.scheduled-ticket-rrule-builder__weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-top: 0.35rem;
}

.scheduled-ticket-rrule-builder__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  font-size: 0.8125rem;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
}

.scheduled-ticket-rrule-builder__chip:has(input:checked) {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.scheduled-ticket-rrule-builder__chip input {
  margin: 0;
}

.scheduled-ticket-rrule-builder__end-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 0.35rem;
}

.scheduled-ticket-rrule-builder__radio {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.scheduled-ticket-rrule-builder__end-detail {
  margin-top: 0.5rem;
}

.scheduled-ticket-rrule-builder__count {
  width: 5rem;
}

.scheduled-ticket-rrule-builder__preview {
  margin: 0.65rem 0 0.5rem;
}

.scheduled-ticket-rrule-builder__preview-label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
}

.scheduled-ticket-rrule-builder__preview-code {
  display: block;
  padding: 0.5rem 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  min-height: 1.4rem;
  word-break: break-all;
  background: var(--message-well-bg);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
}

/* Dashboard — modular widget board */
.dashboard-page__empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.dashboard-page .page-head__title-tools .ticket-toolbar {
  margin-left: auto;
  justify-content: flex-end;
}

/* The board's GridStack resize handles are later siblings of the sticky
   page-head, so the menu is lifted out as a viewport-fixed overlay by
   actions-menu. `isolation` keeps the transparent item rows compositing against
   the panel's own surface rather than whatever sits beneath it. */
.dashboard-add-widget__panel {
  min-width: 18rem;
  background: var(--surface);
  isolation: isolate;
}

/* Before GridStack initializes (and if its script never loads) widgets stay in
   normal flow so the board is still readable. Selectors intentionally outrank
   gridstack.css, which absolutely positions cells and their content. */
.dashboard-grid:not(.dashboard-grid--ready) {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-grid:not(.dashboard-grid--ready) > .grid-stack-item {
  position: relative;
  width: 100%;
  height: auto;
}

.dashboard-grid:not(.dashboard-grid--ready) > .grid-stack-item > .grid-stack-item-content {
  position: relative;
  inset: auto;
  width: auto;
  min-height: 8rem;
}

/* Theme GridStack's structural chrome: its stock handle is a hardcoded grey SVG
   and its drop placeholder a black wash, neither of which reads in dark mode. */
.dashboard-grid .grid-stack-item > .ui-resizable-se {
  width: 0.85rem;
  height: 0.85rem;
  background-image: none;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  border-bottom-right-radius: 0.3rem;
  transform: none;
  opacity: 0.45;
  /* GridStack ships the corner handles at z-index 101 in the root stacking
     context, which outranks the sticky page-head (30) and everything anchored
     inside it. Anything above the widget's own content is enough. */
  z-index: 1;
}

.dashboard-grid .grid-stack-item:hover > .ui-resizable-se,
.dashboard-grid .grid-stack-item.ui-resizable-resizing > .ui-resizable-se {
  opacity: 1;
}

.dashboard-grid > .grid-stack-placeholder > .placeholder-content {
  border: 1px dashed var(--primary);
  border-radius: 0.5rem;
  background-color: color-mix(in srgb, var(--primary) 8%, transparent);
}

.dashboard-widget {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  overflow: hidden;
}

.dashboard-widget__header {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.4rem 0.5rem 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

/* Drag surface: title, the refresh clock, and the flexible gap beside them.
   Filter controls and the close button sit outside it so they stay clickable;
   the clock can live inside because GridStack never starts a drag on a button. */
.dashboard-widget__grip {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 0.4rem;
  min-width: 0;
  min-height: var(--tickets-compact-control-height);
  cursor: grab;
}

.dashboard-grid:not(.dashboard-grid--ready) .dashboard-widget__grip {
  cursor: default;
}

.grid-stack-item.ui-draggable-dragging .dashboard-widget__grip {
  cursor: grabbing;
}

.dashboard-widget__title {
  flex: 0 1 auto;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-widget__title-extras {
  font: inherit;
}

/* Refresh cadence control, beside the title. `position: relative` only anchors
   the menu before JavaScript re-places it as a viewport-fixed overlay, which is
   what lets it escape the widget's own `overflow: hidden`. */
.dashboard-widget__clock {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  cursor: default;
}

.dashboard-widget__clock-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.4rem;
  color: var(--muted);
}

.dashboard-widget__clock-label {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-widget__clock-menu {
  min-width: 7rem;
}

/* Per-widget filter slot: compact filter controls first, then the summary meta
   and links a refresh rewrites. */
.dashboard-widget__filters {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  gap: 0.5rem;
  min-width: 0;
}

.dashboard-widget__filters:empty,
.dashboard-widget__filters--empty {
  display: none;
}

.dashboard-widget__filters .ticket-view-switcher__select {
  min-width: 8rem;
}

.dashboard-agent-filter {
  position: relative;
  flex: 0 0 auto;
}

.dashboard-agent-filter__trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: var(--tickets-compact-control-height);
  min-height: var(--tickets-compact-control-height);
  min-width: 6.5rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.15;
  cursor: pointer;
}

.dashboard-agent-filter__trigger:hover {
  border-color: var(--muted);
}

.dashboard-agent-filter__trigger:focus-visible {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 1px;
}

.dashboard-agent-filter__caret {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-agent-filter__panel {
  box-sizing: border-box;
  z-index: 220;
  overflow: hidden;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 14%, transparent);
}

.dashboard-agent-filter__panel[hidden] {
  display: none;
}

.dashboard-agent-filter__choice,
.dashboard-agent-filter__agent {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2rem;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  white-space: nowrap;
}

.dashboard-agent-filter__choice {
  cursor: pointer;
}

.dashboard-agent-filter__choice:hover,
.dashboard-agent-filter__choice:focus-visible,
.dashboard-agent-filter__agent:hover {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  outline: none;
}

.dashboard-agent-filter__choice[aria-checked="true"] {
  font-weight: 600;
}

.dashboard-agent-filter__agents {
  max-height: 14rem; /* Seven 2rem agent rows; longer rosters scroll. */
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.dashboard-agent-filter__agent {
  gap: 0.5rem;
  cursor: pointer;
}

.dashboard-agent-filter__agent input {
  flex: 0 0 auto;
  margin: 0;
}

.dashboard-date-range-filter {
  position: relative;
  flex: 0 0 auto;
}

.dashboard-date-range-filter__trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: var(--tickets-compact-control-height);
  min-height: var(--tickets-compact-control-height);
  min-width: 6.5rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.15;
  cursor: pointer;
}

.dashboard-date-range-filter__trigger:hover {
  border-color: var(--muted);
}

.dashboard-date-range-filter__trigger:focus-visible {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 1px;
}

.dashboard-date-range-filter__caret {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-date-range-filter__panel {
  box-sizing: border-box;
  width: max-content;
  z-index: 220;
  overflow: auto;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 14%, transparent);
}

.dashboard-date-range-filter__panel[hidden] {
  display: none;
}

.dashboard-date-range-filter__option {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2rem;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.dashboard-date-range-filter__option:hover,
.dashboard-date-range-filter__option:focus-visible {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  outline: none;
}

.dashboard-date-range-filter__option--selected,
.dashboard-date-range-filter__option[aria-selected="true"] {
  font-weight: 600;
}

.dashboard-date-range-filter__custom {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
  padding: 0.45rem 0.35rem 0.3rem;
  border-top: 1px solid var(--border);
}

.dashboard-date-range-filter__date {
  box-sizing: border-box;
  height: var(--tickets-compact-control-height);
  min-height: var(--tickets-compact-control-height);
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.dashboard-date-range-filter__date:focus-visible {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 1px;
}

/* Header bits a refresh replaces. Kept as its own stream target so rewriting a
   count or a drill-through link never touches a focused filter control. */
.dashboard-widget__extras {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.dashboard-widget__close {
  flex: 0 0 auto;
  width: var(--tickets-compact-control-height);
  font-size: 1rem;
  line-height: 1;
}

.dashboard-widget__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem;
}

.dashboard-tickets-summary__meta,
.dashboard-due-tasks-summary__meta,
.dashboard-ticket-time__meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.dashboard-tickets-summary__meta-link,
.dashboard-due-tasks-summary__meta-link,
.dashboard-ticket-time__meta-link {
  color: inherit;
  text-decoration: none;
}

.dashboard-tickets-summary__meta-link:hover,
.dashboard-tickets-summary__meta-link:focus-visible,
.dashboard-due-tasks-summary__meta-link:hover,
.dashboard-due-tasks-summary__meta-link:focus-visible,
.dashboard-ticket-time__meta-link:hover,
.dashboard-ticket-time__meta-link:focus-visible {
  text-decoration: underline;
}

.dashboard-tickets-summary__empty,
.dashboard-due-tasks-summary__empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.dashboard-stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.75rem;
}

.dashboard-stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  min-height: 5.5rem;
}

.dashboard-stat-card--interactive {
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.dashboard-stat-card--interactive:hover {
  border-color: var(--primary);
  box-shadow: 0 1px 0 rgba(37, 99, 235, 0.12);
}

.dashboard-stat-card--interactive:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.dashboard-stat-card--static {
  cursor: default;
  opacity: 0.95;
}

.dashboard-stat-card--toned {
  border-color: color-mix(in srgb, var(--stat-card-tone) 40%, var(--border));
  border-left: 4px solid var(--stat-card-tone);
  background: color-mix(in srgb, var(--stat-card-tone) 12%, var(--surface));
}

.dashboard-stat-card--toned.dashboard-stat-card--interactive:hover {
  border-color: var(--stat-card-tone);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--stat-card-tone) 25%, transparent);
}

.dashboard-stat-card__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.dashboard-stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.dashboard-stat-card__detail {
  font-size: 0.75rem;
  color: var(--muted);
}

.dashboard-stat-card__hint {
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--muted);
}

.dashboard-stat-card--interactive .dashboard-stat-card__hint {
  color: var(--primary);
}

.dashboard-stat-card--satisfaction {
  align-items: center;
  text-align: center;
}

.dashboard-stat-card__icon {
  display: block;
  width: 3rem;
  height: 3rem;
  object-fit: contain;
  flex-shrink: 0;
}

/* Dashboard — recently visited tickets */
.dashboard-recently-visited__meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.dashboard-recently-visited__empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.dashboard-recently-visited__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dashboard-recently-visited__item {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.dashboard-recently-visited__item:hover {
  border-color: var(--primary);
  box-shadow: 0 1px 0 rgba(37, 99, 235, 0.12);
}

.dashboard-recently-visited__link {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.875rem;
}

.dashboard-recently-visited__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.dashboard-recently-visited__link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 0.5rem;
}

.dashboard-recently-visited__id {
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.dashboard-recently-visited__subject {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.dashboard-recently-visited__detail {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.75rem;
}

.dashboard-recently-visited__pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.dashboard-recently-visited__pill--colored {
  background: color-mix(
    in srgb,
    var(--dashboard-pill-color, var(--muted)) 22%,
    var(--surface)
  );
  border-color: color-mix(
    in srgb,
    var(--dashboard-pill-color, var(--border)) 55%,
    var(--border)
  );
  color: var(--text);
}

@media (max-width: 36rem) {
  .dashboard-recently-visited__link {
    grid-template-columns: auto 1fr;
    grid-auto-rows: auto;
  }

  .dashboard-recently-visited__status,
  .dashboard-recently-visited__priority {
    grid-column: 2;
    justify-self: start;
  }
}

/* Dashboard — ticket time */
.dashboard-ticket-time {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.dashboard-ticket-time__empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.dashboard-ticket-time__list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dashboard-ticket-time__item {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.dashboard-ticket-time__item:hover {
  border-color: var(--primary);
  box-shadow: 0 1px 0 rgba(37, 99, 235, 0.12);
}

/* Subject and requester share the flexible middle column so both ellipsize
   instead of pushing the duration out of a narrow widget. */
.dashboard-ticket-time__link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.875rem;
}

.dashboard-ticket-time__link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 0.5rem;
}

.dashboard-ticket-time__id {
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.dashboard-ticket-time__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.dashboard-ticket-time__subject {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.dashboard-ticket-time__detail {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.75rem;
}

.dashboard-ticket-time__duration {
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Dashboard — ticket time by category */
.dashboard-category-time {
  min-width: 0;
}

.dashboard-category-time__empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.dashboard-category-time__list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dashboard-category-time__link {
  display: grid;
  grid-template-columns: minmax(6rem, 30%) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.4rem;
  border-radius: 0.4rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.875rem;
}

.dashboard-category-time__link:hover,
.dashboard-category-time__link:focus-visible {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.dashboard-category-time__link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.dashboard-category-time__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.dashboard-category-time__track {
  height: 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  overflow: hidden;
}

.dashboard-category-time__fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.2s ease;
}

.dashboard-category-time__duration {
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Dashboard — recent activity feed */
.dashboard-recent-activity {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dashboard-recent-activity__meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.dashboard-recent-activity__list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dashboard-recent-activity__empty {
  margin: 0;
  padding: 0.5rem 0.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.dashboard-recent-activity__item {
  border: 1px solid transparent;
  border-radius: 0.4rem;
}

.dashboard-recent-activity__item:hover {
  border-color: var(--border);
  background: var(--surface);
}

.dashboard-recent-activity__link {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.55rem;
  text-decoration: none;
  color: inherit;
}

.dashboard-recent-activity__link--static {
  cursor: default;
  color: var(--muted);
}

.dashboard-recent-activity__link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 0.4rem;
}

.dashboard-recent-activity__body {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dashboard-recent-activity__text {
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--text);
  overflow-wrap: anywhere;
}

.dashboard-recent-activity__detail {
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.dashboard-recent-activity__link--static .dashboard-recent-activity__text {
  color: var(--muted);
}

.dashboard-recent-activity__time {
  flex: 0 0 auto;
  padding-top: 0.1rem;
  font-size: 0.6875rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Workspace emoji picker (used in the global admin workspace edit drawer) */
.workspace-emoji {
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
    "Noto Color Emoji", "Twemoji Mozilla", "EmojiOne Color", "Android Emoji",
    sans-serif;
  font-style: normal;
}

/* Global Admin > Workspaces: a Simple table (docs/typography.md), not a
   table page. Headers stay on one line; ID, Prefix and the counts line up
   right (Prefix too, by request: short codes read better beside the IDs). */
.global-admin-workspaces-table {
  margin-top: 0.5rem;
}

.global-admin-workspaces-table .sortable-table__sort {
  white-space: nowrap;
}

.global-admin-workspaces-table th.global-admin-workspaces-table__num {
  text-align: right;
}

.workspace-name-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.workspace-name-link__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.workspace-name-link__text {
  min-width: 0;
}

.workspace-requesters-count {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.workspace-directory-sync-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #166534;
  color: #ffffff;
}

.workspace-count--pending {
  color: var(--muted);
}

.workspace-directory-sync-status {
  display: block;
  font-size: 0.8em;
  color: var(--muted);
  white-space: nowrap;
}

.workspace-emoji-picker {
  position: relative;
}

.workspace-emoji-picker__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.workspace-emoji-picker__trigger:hover {
  border-color: var(--primary);
}

.workspace-emoji-picker__trigger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.workspace-emoji-picker__preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  font-size: 1.25rem;
  color: var(--text);
}

.workspace-emoji-picker__placeholder {
  color: var(--muted);
  display: inline-flex;
}

.workspace-emoji-picker__label {
  color: var(--text);
  font-size: 0.85rem;
}

.workspace-emoji-picker__popover {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  width: min(24rem, calc(100vw - 2rem));
  z-index: 120;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.workspace-emoji-picker__popover[hidden] {
  display: none;
}

.workspace-emoji-picker__search-row {
  display: flex;
}

.workspace-emoji-picker__search {
  width: 100%;
}

.workspace-emoji-picker__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

.workspace-emoji-picker__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
  font-size: 1.05rem;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
    sans-serif;
}

.workspace-emoji-picker__tab:hover {
  border-color: var(--border);
  background: var(--bg);
}

.workspace-emoji-picker__tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.workspace-emoji-picker__tab--active {
  border-color: var(--primary);
  background: var(--bg);
}

.workspace-emoji-picker__status {
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 1.1em;
}

.workspace-emoji-picker__grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.15rem;
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.15rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.workspace-emoji-picker__grid:empty {
  border-style: dashed;
  min-height: 4rem;
}

.workspace-emoji-picker__cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
    sans-serif;
}

.workspace-emoji-picker__cell:hover {
  border-color: var(--primary);
  background: var(--surface);
}

.workspace-emoji-picker__cell:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.workspace-emoji-picker__cell--selected {
  border-color: var(--primary);
  background: var(--surface);
}

.workspace-emoji-picker__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Automation rules */
.automation-empty {
  color: var(--muted);
  padding: 1rem 0;
}

.automation-rule-name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.automation-rule-order-handle {
  cursor: grab;
  color: var(--muted);
  user-select: none;
}

.automation-rule-order-number {
  color: var(--muted);
}

.ticket-table__th--order,
.ticket-table__td--order {
  width: 3.5rem;
  text-align: center;
}

.automation-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.automation-badge--on {
  background: var(--badge-open-bg);
  color: var(--badge-open-text);
}

.automation-badge--off {
  background: var(--bg-subtle);
  color: var(--muted);
}

/* Medium-tier canned-response drawer panels (canned responses, automation rules, scenarios, scheduled tickets). */
.canned-response-drawer__panel--medium {
  width: var(--drawer-width-medium);
  max-width: var(--drawer-width-medium);
}

/* Large-tier canned-response drawer panels (Knowledge articles: long documents with screenshots). */
.canned-response-drawer__panel--large {
  width: var(--drawer-width-large);
  max-width: var(--drawer-width-large);
}

/* Automation rule editor */
.automation-section {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface);
}

.automation-section__heading {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.automation-section__hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.automation-group {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.automation-group--root {
  border-style: solid;
}

.automation-group__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.automation-group__match-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.automation-group__operator {
  width: auto;
  min-width: 5rem;
}

.automation-group__remove {
  margin-left: auto;
}

.automation-group__children {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border);
}

.automation-group__children:empty {
  display: none;
}

.automation-group__controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.automation-condition,
.automation-action {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.automation-condition__field,
.automation-condition__op,
.automation-action__type {
  width: auto;
  flex: 0 1 12rem;
}

.automation-condition__value,
.automation-action__value {
  width: auto;
  flex: 1 1 12rem;
}

.automation-action > .custom-select:has(.automation-action__type) {
  flex: 0 1 15rem;
}

.automation-action > .custom-select:has(.automation-action__value),
.automation-action > .automation-action__value {
  flex: 1 1 12rem;
  min-width: 0;
}

.automation-action__watchers {
  flex: 1 1 16rem;
  min-width: 12rem;
}

/* Compact badge chips (automation recipient pickers): agents as filled name
   badges, typed addresses as outlined badges. The field keeps the row's
   control height so it lines up with the action type select beside it. */
.recipient-chips--compact {
  gap: 0.25rem;
}

.recipient-chips--compact .recipient-chips__chip {
  gap: 0.125rem;
  max-width: 16rem;
  padding: 0 0.125rem 0 0.5rem;
  border-style: dashed;
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.125rem;
}

.recipient-chips--compact .recipient-chips__chip--named {
  border-style: solid;
  border-color: var(--bg-subtle);
  background: var(--bg-subtle);
}

.recipient-chips--compact .recipient-chips__chip-remove {
  width: 0.875rem;
  height: 0.875rem;
}

.recipient-chips--compact .recipient-chips__input {
  flex-basis: 6rem;
  min-width: 6rem;
}

.automation-action:has(.automation-action__watchers) {
  align-items: flex-start;
}

.automation-action:has(.automation-action__watchers) > .automation-small-button {
  margin-top: 0.23rem;
}

.automation-condition > .automation-small-button,
.automation-action > .automation-small-button {
  margin-left: auto;
}

.automation-small-button {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.ticket-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  box-sizing: border-box;
  max-width: 360px;
  padding: 0.5rem 0.625rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 14%, transparent);
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
  pointer-events: none;
}

/* Help content inside the floating box (shared/_help_tip): short bullets. */
.ticket-tooltip--rich ul {
  margin: 0;
  padding-left: 1.1rem;
}

.ticket-tooltip--rich li + li {
  margin-top: 0.2rem;
}

/* Help tip: a muted "?" right after a section heading (docs/typography.md,
   "Help tip"). The heading and its tip sit together on the left of the
   heading row; section buttons stay on the right. */
.section-heading-with-help {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.section-heading-with-help > :is(h2, h3, h4) {
  margin: 0;
}

/* A heading-with-help that heads a section directly (not inside a heading
   row with buttons) keeps the heading's usual space below it. */
.issue-drawer__section > .section-heading-with-help {
  margin-bottom: 0.5rem;
}

/* A field's label with a help tip after it, in the label column. The tip
   can't go inside the <label> (a button there would be a second control). */
.field-label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.field-label-with-help > label {
  color: inherit;
}

.help-tip {
  display: inline-flex;
  align-items: center;
}

.help-tip__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: help;
}

.help-tip__button:hover,
.help-tip__button:focus-visible {
  color: var(--text);
}

.help-tip__button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  outline-offset: 1px;
}

/* Email notifications admin. Defaults until the user resizes (inline widths from ticket-table win). */
.email-notifications-table :is(th, td)[data-column-key="notification"] {
  width: 16rem;
}

.email-notifications-table :is(th, td)[data-column-key="audience"] {
  width: 9rem;
}

.email-notifications-table :is(th, td)[data-column-key="description"] {
  width: 32rem;
  max-width: 32rem;
}

.email-notifications-table td[data-column-key="description"] {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-notifications-table :is(th, td)[data-column-key="status"] {
  width: 9rem;
}

.email-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.email-toggle__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.email-toggle__track {
  position: relative;
  display: inline-block;
  width: 2.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--text) 28%, transparent);
  border-radius: 999px;
  transition: background 0.15s ease;
}

.email-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.25rem - 4px);
  height: calc(1.25rem - 4px);
  background: var(--surface);
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.email-toggle__input:checked + .email-toggle__track {
  background: var(--primary);
}

.email-toggle__input:checked + .email-toggle__track .email-toggle__thumb {
  transform: translateX(1rem);
}

.email-toggle__input:focus-visible + .email-toggle__track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.email-toggle__text {
  font-size: 0.85rem;
  color: var(--muted);
}

.email-toggle--disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.email-notification-form__placeholders {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.email-placeholder-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.email-placeholder-chip:hover {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border-color: var(--primary);
}

.email-placeholder-chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.email-notification-form__hint {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Ticket history: view-only fly-in drawer from the right */
.ticket-history-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
  overscroll-behavior: contain;
}

.ticket-history-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.ticket-history-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.ticket-history-drawer--open .ticket-history-drawer__backdrop {
  opacity: 1;
}

.ticket-history-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.ticket-history-drawer--open .ticket-history-drawer__panel {
  transform: translateX(0);
}

.ticket-history-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.ticket-history-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.ticket-history-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.ticket-history-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.ticket-history-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

/* History list */
.ticket-history-drawer__body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ticket-history-drawer__empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.ticket-history-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ticket-history-drawer__entry,
.asset-history__entry {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.ticket-history-drawer__entry:first-child,
.asset-history__entry:first-child {
  border-top: 1px solid var(--border);
}

.ticket-history-drawer__entry-header,
.asset-history__entry-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.4rem;
}

.ticket-history-drawer__entry-label,
.asset-history__entry-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.ticket-history-drawer__entry-time,
.asset-history__entry-time {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.ticket-history-drawer__entry-summary,
.asset-history__entry-summary {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.ticket-history-drawer__changeset,
.asset-history__changeset {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ticket-history-drawer__change-row,
.asset-history__change-row {
  margin-bottom: 0 !important;
}

.ticket-history-drawer__change-value,
.asset-history__change-value {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.ticket-history-drawer__change-from,
.asset-history__change-from {
  color: var(--muted);
  text-decoration: line-through;
}

.ticket-history-drawer__change-arrow,
.asset-history__change-arrow {
  color: var(--muted);
  font-size: 0.8rem;
}

.ticket-history-drawer__change-to,
.asset-history__change-to {
  color: var(--text);
}

/* Ticket watchers: edit fly-in drawer from the right */
.ticket-watchers-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
  overscroll-behavior: contain;
}

.ticket-watchers-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.ticket-watchers-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.ticket-watchers-drawer--open .ticket-watchers-drawer__backdrop {
  opacity: 1;
}

.ticket-watchers-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.ticket-watchers-drawer--open .ticket-watchers-drawer__panel {
  transform: translateX(0);
}

.ticket-watchers-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.ticket-watchers-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.ticket-watchers-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.ticket-watchers-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.ticket-watchers-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

.ticket-watchers-drawer .recipient-chips {
  width: 100%;
}

/* Drawer heads pin to the top of their scroll container so the title and
   Save / Cancel / Close stay reachable in long drawers. Negative margins pull
   the head out to the inner's padding edges so body content passes behind it. */
.ticket-filters-drawer__head,
.requester-profile-drawer__head,
.portal-drawer__head,
.asset-drawer__head,
.data-transfer-drawer__head,
.global-admin-user-drawer__head,
.global-admin-workspace-drawer__head,
.global-admin-directory-drawer__head,
.role-definition-drawer__head,
.permissions-drawer__head,
.user-preferences-drawer__head,
.canned-response-drawer__head,
.ticket-history-drawer__head,
.ticket-watchers-drawer__head,
.installed-application-drawer__head {
  position: sticky;
  /* Sticky constrains the margin box, so the offset cancels the -1rem top
     margin below; otherwise the head parks 1rem down and body text scrolls
     through the inner's top padding above it. */
  top: -1rem;
  z-index: 12;
  background: var(--surface);
  margin: -1rem -1.25rem 0.25rem;
  padding: 1rem 1.25rem 0.75rem;
}

/* ---------------------------------------------------------------------------
   Installed applications drawer (read-only, small tier)
   --------------------------------------------------------------------------- */

.installed-application-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  visibility: hidden;
  overscroll-behavior: contain;
}

.installed-application-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.installed-application-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.installed-application-drawer--open .installed-application-drawer__backdrop {
  opacity: 1;
}

.installed-application-drawer__panel {
  position: relative;
  z-index: 1;
  width: var(--drawer-width-small);
  max-width: var(--drawer-width-small);
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
}

.installed-application-drawer--open .installed-application-drawer__panel {
  transform: translateX(0);
}

.installed-application-drawer__panel turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.installed-application-drawer__inner {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.installed-application-drawer__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.installed-application-drawer__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.installed-application-drawer__title {
  margin: 0;
  font-size: 1.1rem;
}

.installed-application-drawer__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1.25rem 0 0.5rem;
}

.installed-application-drawer__section-title {
  font-size: 1rem;
  margin: 0;
}

.installed-application-drawer__table-wrap {
  overflow-x: auto;
}

/* ---------------------------------------------------------------------------
   Freshservice Archive (read-only imported ticket history)
   --------------------------------------------------------------------------- */

.fs-archive__search {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
}

.fs-archive__search .ticket-details-field__input {
  min-width: 16rem;
  max-width: min(24rem, 100%);
}

.fs-archive__meta {
  margin-bottom: 1.25rem;
}

.fs-archive__resolution {
  background: var(--message-well-bg);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.fs-archive__resolution h2,
.fs-archive__thread h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.fs-archive__thread h2 {
  margin-bottom: 1rem;
}

.fs-message {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 0.875rem 1.125rem;
  margin-bottom: 0.875rem;
}

.fs-message--opening {
  border-left-color: var(--primary);
}

.fs-message--incoming {
  border-left-color: var(--badge-open-bg);
}

/* Private notes were never visible to the requester; keep that obvious. */
.fs-message--note {
  background: var(--message-well-bg);
  border-left-color: var(--badge-priority-high-bg);
}

.fs-message__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.fs-message__author {
  font-weight: 600;
}

.fs-message__kind {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.fs-message__head time {
  color: var(--muted);
  font-size: 0.8125rem;
  margin-left: auto;
}

.fs-message__recipients {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.8125rem;
  margin: 0 0 0.5rem;
}

.fs-message__body {
  overflow-x: auto;
}

.fs-message__body img {
  max-width: 100%;
  height: auto;
}

.fs-message__body table {
  max-width: 100%;
}

.fs-message__attachments {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.fs-message__attachments li {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
}

.fs-message__attachment-size {
  color: var(--muted);
  font-size: 0.75rem;
}

/* A link to a Freshservice ticket that was never imported. Rendered inert so it
   reads as deliberately unavailable rather than as a broken link. */
.fs-message__link--unarchived {
  color: var(--muted);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: help;
}

.fs-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--bg-subtle);
  color: var(--text);
}

.fs-badge--open {
  background: var(--badge-open-bg);
  color: var(--badge-open-text);
}

.fs-badge--resolved {
  background: var(--badge-resolved-bg);
  color: var(--badge-resolved-text);
}

.fs-badge--closed {
  background: var(--badge-closed-bg);
  color: var(--badge-closed-text);
}

/* ---------------------------------------------------------------------------
   Freshservice import control panel (Global Admin)
   --------------------------------------------------------------------------- */

.fs-import .button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--tickets-compact-control-height);
  min-height: var(--tickets-compact-control-height);
  padding: 0.15rem 0.72rem;
  line-height: 1.15;
}

.fs-import__intro {
  color: var(--muted);
  max-width: 62rem;
  margin: 0 0 1.25rem;
}

.fs-import__panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.125rem 1.25rem;
  margin-bottom: 1.25rem;
}

.fs-import__panel--active {
  border-color: var(--badge-open-text, var(--border));
}

.fs-import__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.fs-import__panel h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.fs-import__panel-head h2 {
  margin: 0;
}

.fs-import__muted,
.fs-import__hint {
  color: var(--muted);
}

.fs-import__muted {
  max-width: 62rem;
  margin: 0 0 1rem;
}

.fs-import__hint {
  display: inline-block;
  font-size: 0.8125rem;
}

.fs-import__warning {
  background: var(--message-well-bg);
  border-left: 3px solid var(--badge-open-text, var(--border));
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem 0 0;
}

.fs-import__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
}

.fs-import__stat {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.fs-import__stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
}

.fs-import__stat-label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.fs-import__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.fs-import__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 14rem;
}

.fs-import__field--narrow {
  min-width: 8rem;
}

.fs-import__field--wide {
  flex: 1 1 26rem;
}

.fs-import__field--check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.fs-import__field label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.fs-import__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-basis: 100%;
}

.fs-import__preview {
  flex-basis: 100%;
  margin: 0;
  padding: 0.625rem 0.875rem;
  background: var(--bg-subtle);
  border-radius: 6px;
}

.fs-import__table {
  width: 100%;
  margin-top: 0.5rem;
}

.fs-import__error {
  color: var(--muted);
  font-size: 0.8125rem;
  word-break: break-word;
}

.fs-import__progress-bar {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.fs-import__progress-fill {
  height: 100%;
  background: var(--badge-open-text, currentColor);
  transition: width 0.3s ease;
}

.fs-import__progress-text {
  margin: 0.625rem 0 1rem;
}

.fs-import__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 0 0 1rem;
}

.fs-import__facts dt {
  color: var(--muted);
  font-size: 0.8125rem;
  margin-bottom: 0.125rem;
}

.fs-import__facts dd {
  margin: 0;
  color: var(--text);
}

.fs-import__badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--bg-subtle);
  color: var(--text);
}

.fs-import__badge--running,
.fs-import__badge--ok,
.fs-import__badge--completed {
  background: var(--badge-resolved-bg);
  color: var(--badge-resolved-text);
}

.fs-import__badge--paused,
.fs-import__badge--warn {
  background: var(--badge-open-bg);
  color: var(--badge-open-text);
}

.fs-import__badge--cancelled {
  background: var(--badge-closed-bg);
  color: var(--badge-closed-text);
}

/* ---- Assets column picker drawer ---- */
.table-column-badge {
  display: inline-block;
  margin-left: 0.35em;
  padding: 0.05em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  vertical-align: middle;
  line-height: 1.4;
}

.table-column-badge--s1 {
  background: var(--badge-open-bg, var(--bg-subtle));
  color: var(--badge-open-text, var(--text));
}

.asset-columns-drawer__search {
  display: block;
  margin: 0.5rem 0 1rem;
}

.asset-columns-drawer__search-input {
  width: 100%;
}

.asset-columns-drawer__zone {
  margin-bottom: 1.25rem;
}

.asset-columns-drawer__zone-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, var(--text));
}

.asset-columns-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  min-height: 2.5rem;
  border: 1px dashed var(--border, #ccc);
  border-radius: 0.375rem;
  background: var(--bg-subtle, transparent);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.asset-columns-drawer__list--drop-target {
  border-color: var(--accent, #4a7);
  background: var(--bg, #fff);
}

.asset-columns-drawer__item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.25rem;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #ddd);
  cursor: grab;
  user-select: none;
}

.asset-columns-drawer__item--locked {
  cursor: default;
  opacity: 0.95;
}

.asset-columns-drawer__item--dragging {
  opacity: 0.55;
}

.asset-columns-drawer__handle {
  color: var(--text-muted, #888);
  font-size: 0.75rem;
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
}

.asset-columns-drawer__label {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
}

.asset-columns-drawer__item-actions {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}

.asset-columns-drawer__icon-btn {
  padding: 0.1rem 0.4rem !important;
  min-width: 1.6rem;
  line-height: 1.2;
  font-size: 0.8rem;
}

.asset-columns-drawer__item[hidden] {
  display: none !important;
}

/* ---- Assets filter builder ------------------------------------------------ */

.filter-builder__hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.filter-builder__root {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-builder__group {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--surface);
}

.filter-builder__group--root {
  border-style: solid;
}

.filter-builder__group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.filter-builder__match-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.filter-builder__group-operator {
  width: auto;
  min-width: 5rem;
  flex: 0 0 auto;
}

.filter-builder__group-remove {
  margin-left: auto;
}

.filter-builder__children {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-builder__children:empty {
  display: none;
}

/* Nested groups read as a branch off the parent list. */
.filter-builder__group .filter-builder__group {
  margin: 0.25rem 0 0.25rem 0.75rem;
  border-left: 3px solid var(--border);
  border-radius: 0 8px 8px 0;
  background: rgba(127, 127, 127, 0.06);
}

.filter-builder__controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* Fixed column tracks keep Field / Operator / Value / Remove aligned across rows. */
.filter-builder__condition {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr) minmax(0, 1.5fr) auto;
  gap: 0.5rem;
  align-items: start;
}

.filter-builder__cell {
  min-width: 0;
}

.filter-builder__value {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  min-width: 0;
}

.filter-builder__value-input {
  width: 100%;
  min-width: 0;
}

.filter-builder__value .suggest-input {
  width: 100%;
  min-width: 0;
}

.filter-builder__condition-remove {
  align-self: start;
}

.filter-builder__small-button {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .filter-builder__condition {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .filter-builder__condition .filter-builder__cell--value {
    grid-column: 1 / -1;
  }
}

/* ---- Filter combobox (field / operator typeahead) ------------------------- */

.filter-combobox {
  position: relative;
  display: block;
  min-width: 0;
}

.filter-combobox__input {
  width: 100%;
  min-width: 0;
  padding-right: 1.6rem;
}

.filter-combobox--badged .filter-combobox__input {
  padding-right: 3.6rem;
}

.filter-combobox__badge {
  position: absolute;
  top: 50%;
  right: 1.6rem;
  margin-left: 0;
  transform: translateY(-50%);
  pointer-events: none;
}

.filter-combobox__badge[hidden] {
  display: none;
}

.filter-combobox__caret {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1.6rem;
  margin: 0;
  padding: 0;
  border: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.6rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%23828a94' d='M0 0l5 6 5-6z'/></svg>");
  cursor: pointer;
  pointer-events: auto;
}

@media (prefers-color-scheme: dark) {
  .filter-combobox__caret {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%239ebacf' d='M0 0l5 6 5-6z'/></svg>");
  }
}

html[data-user-theme="light"] .filter-combobox__caret {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%23828a94' d='M0 0l5 6 5-6z'/></svg>");
}

html[data-user-theme="dark"] .filter-combobox__caret {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%239ebacf' d='M0 0l5 6 5-6z'/></svg>");
}

/*
  Absolute (not fixed): the drawer panel is transformed, which would make a
  fixed dropdown position against the panel instead of the viewport.
*/
.filter-combobox__list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 40;
  margin: 0;
  padding: 0.25rem 0;
  min-width: 100%;
  max-width: 22rem;
  max-height: 16rem;
  overflow-y: auto;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.filter-combobox__list[hidden] {
  display: none;
}

.filter-combobox__group {
  position: sticky;
  top: 0;
  background: var(--surface);
  padding: 0.35rem 0.75rem 0.15rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.filter-combobox__option {
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-combobox__option:hover,
.filter-combobox__option--active {
  background: rgba(127, 127, 127, 0.22);
}

/* =========================================================================
   Customer portal
   Reuses the agent design tokens and shell; these rules only cover layout
   primitives the agent app has no equivalent for (summary tiles, request
   list rows, conversation thread).
   ========================================================================= */

.portal-form-column {
  max-width: 42rem;
}

.portal-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.portal-empty__title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.portal-empty__body {
  margin: 0 0 1rem;
  color: var(--muted);
}

/* Summary tiles */
.portal-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.portal-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 120ms ease-out, transform 120ms ease-out;
}

.portal-tile:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.portal-tile--attention {
  border-left-color: #b45309;
}

.portal-tile--resolved {
  border-left-color: #15803d;
}

.portal-tile--closed {
  border-left-color: var(--muted);
}

.portal-tile--open {
  border-left-color: var(--primary);
}

.portal-tile__count {
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.1;
}

.portal-tile__label {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Sections */
.portal-section {
  margin-bottom: 1.75rem;
}

.portal-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.6rem;
}

.portal-section__title {
  margin: 0;
  font-size: 1.05rem;
}

.portal-section__hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.portal-details__summary {
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

/* Request list */
.portal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.portal-list__item + .portal-list__item {
  border-top: 1px solid var(--border);
}

.portal-list__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
}

.portal-list__link:hover {
  background: rgba(127, 127, 127, 0.08);
}

.portal-list__main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.portal-list__subject {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-list__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.portal-list__id {
  font-variant-numeric: tabular-nums;
}

/* Status chips */
.portal-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  white-space: nowrap;
  border: 1px solid transparent;
}

.portal-chip--open {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(37, 99, 235, 0.35);
}

.portal-chip--attention {
  background: rgba(180, 83, 9, 0.16);
  border-color: rgba(180, 83, 9, 0.4);
}

.portal-chip--resolved {
  background: rgba(21, 128, 61, 0.14);
  border-color: rgba(21, 128, 61, 0.35);
}

.portal-chip--closed {
  background: rgba(127, 127, 127, 0.16);
  border-color: rgba(127, 127, 127, 0.32);
}

/* Tabs */
.portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.portal-tabs__tab {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  background: var(--surface);
}

.portal-tabs__tab--active {
  border-color: var(--primary);
  background: rgba(127, 127, 127, 0.12);
  font-weight: 600;
}

/* Ticket detail */
.portal-ticket__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.portal-ticket__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.portal-callout {
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.9rem;
}

.portal-callout--attention {
  border-color: rgba(180, 83, 9, 0.4);
  background: rgba(180, 83, 9, 0.1);
}

/* Conversation thread */
.portal-ticket__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  max-width: 60rem;
}

.portal-thread {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  /* Without a bound, "you" and "team" bubbles drift to opposite edges of a wide
     monitor and stop reading as one conversation. */
  max-width: 60rem;
}

.portal-conversation-compose {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.portal-drawer__inner--conversation .portal-conversation-compose {
  flex: 1;
  min-height: 0;
}

.portal-conversation-compose__thread {
  max-width: none;
}

.portal-drawer__inner--conversation .portal-conversation-compose__thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.portal-conversation-compose__form {
  flex: 0 0 auto;
}

.portal-conversation-compose__form .form__field--attachments-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.portal-conversation-compose__form .message-form__hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.portal-message {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: var(--surface);
  max-width: min(46rem, 85%);
  min-width: min(18rem, 100%);
}

.portal-message--from-you {
  align-self: flex-end;
  border-color: var(--primary);
}

.portal-message--from-team {
  align-self: flex-start;
}

.portal-message__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.4rem;
}

.portal-message__author {
  font-weight: 600;
  font-size: 0.9rem;
}

.portal-message__time {
  font-size: 0.8rem;
  color: var(--muted);
}

.portal-message__tag {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.portal-message__body {
  overflow-wrap: anywhere;
}

.portal-message__body img {
  max-width: 100%;
  height: auto;
}

.portal-message__attachments {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
}

/* Account menu */
.portal-account-menu {
  position: relative;
}

.portal-account-menu__panel {
  /* Clears the base panel's left: 0; without it the panel stays anchored to the
     trigger's left edge and runs off the right of the viewport. */
  left: auto;
  right: 0;
  min-width: 15rem;
}

.portal-account-menu__identity {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.portal-account-menu__name {
  font-weight: 600;
  font-size: 0.9rem;
}

.portal-account-menu__email {
  font-size: 0.8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Drawer extras */
.portal-drawer__context {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.portal-drawer__note {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  background: rgba(127, 127, 127, 0.08);
}

/* Workspace picker + preference swatches */
.portal-radio {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.portal-radio + .portal-radio {
  margin-top: 0.4rem;
}

.portal-radio:has(input:checked) {
  border-color: var(--primary);
  background: rgba(127, 127, 127, 0.08);
}

.portal-radio__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.portal-radio__label {
  font-weight: 500;
}

.portal-radio__desc {
  font-size: 0.83rem;
  color: var(--muted);
}

/* Sign-in */
.portal-login {
  max-width: 26rem;
  margin: 4rem auto;
  text-align: center;
}

.portal-login__title {
  margin: 0 0 0.5rem;
}

.portal-login__body {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

/* Alfred changelog (/changelog): one collapsible block per build, newest open.
   A read-only notes page, so no table toolbar or status strip (see style guide). */
.alfred-changelog__intro {
  margin: -0.5rem 0 1.25rem;
  font-size: 0.9rem;
}

.alfred-changelog__build {
  margin: 0 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.alfred-changelog__summary {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  list-style: none;
}

.alfred-changelog__summary::-webkit-details-marker {
  display: none;
}

.alfred-changelog__summary::before {
  content: "";
  align-self: center;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.alfred-changelog__build[open] > .alfred-changelog__summary::before {
  transform: rotate(45deg);
}

.alfred-changelog__date {
  font-weight: 600;
  color: var(--text);
}

/* Unreleased draft (development only): dashed outline so it never reads as shipped. */
.alfred-changelog__build--draft {
  border-style: dashed;
  border-color: var(--muted);
}

.alfred-changelog__draft-badge {
  color: var(--text);
}

.alfred-changelog__count {
  font-size: 0.85rem;
}

.alfred-changelog__table {
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  box-shadow: none;
}

.alfred-changelog__table tbody tr:last-child td,
.alfred-changelog__table tbody tr:last-child th {
  border-bottom: none;
}

.alfred-changelog__module-col {
  width: 12rem;
}

/* The shared header fill is --bg, which a workspace colour can tint; inside the
   card the header row matches the card instead. */
.table.alfred-changelog__table thead th {
  background: var(--surface);
}

/* Row headers name the module once per group; body text, not the uppercase header style. */
.table.alfred-changelog__table tbody th.alfred-changelog__module {
  vertical-align: top;
  font-size: inherit;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.alfred-changelog__empty {
  margin: 0;
}

/* Knowledge module: an article's page reuses the ticket page's split and
   sidebar cards (knowledge_articles/edit, _sidebar). These rules only fill in
   the card contents and how much of the column each card may take. */
.knowledge-article-main {
  min-width: 0;
}

/* Header of an article's page (knowledge_articles/edit), like a ticket's:
   while editing (?editing=1) the title text swaps for the ticket's title box,
   which fills the row up to the status badge and Save / Cancel. */
/* Workspace settings → Knowledge templates: list intro, and the template
   edit page (actions pushed right in the title row, workspace line under it). */
.knowledge-templates-index__lead {
  margin: 0 0 0.75rem;
  max-width: 60rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.knowledge-template-page__actions {
  margin-left: auto;
}

.knowledge-template-page__actions .button_to {
  display: inline-flex;
}

.knowledge-template-page__workspace {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.knowledge-template-form {
  max-width: 64rem;
}

/* Article History drawer: Claude's one-line summary of an edit reads as the
   entry's main text; the word counts under it stay muted. */
.ticket-history-drawer__entry-summary.knowledge-history__summary {
  color: var(--text);
}

.knowledge-article-page--editing .ticket-show__sticky .page-head h1 {
  display: flex;
  width: 100%;
  flex-wrap: nowrap;
}

.knowledge-article-page--editing .page-head__ticket-subject {
  display: none;
}

.knowledge-article-page--editing .page-head__ticket-subject-input {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 40rem;
}

/* The ticket sidebar pins below the ticket's taller head; an article's head is
   only the slim title bar, so pin just under it. Any larger offset than the
   column's natural position pushes the cards down even before scrolling. */
.knowledge-article-sidebar {
  --ticket-sidebar-top: calc(var(--app-header-offset, 0px) + 3rem);
}

.knowledge-sidebar-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.35rem 1rem;
  margin: 0.5rem 0 0;
}

.knowledge-sidebar-facts dt {
  color: var(--muted);
}

.knowledge-sidebar-facts dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.knowledge-sidebar-text {
  margin-top: 0.5rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.knowledge-sidebar-text p {
  margin: 0 0 0.5rem;
}

/* Links read like table links (style guide: important text), primary on hover. */
.knowledge-sidebar-text a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.knowledge-sidebar-text a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Notes for the reviewer (knowledge_articles/_sidebar, Knowledge::ReviewerNotes):
   one item per issue, divided by hairlines; the issue's topic is a 600-weight
   heading; security notes sit on the danger tint with a warning icon. */
.knowledge-notes {
  margin-top: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.knowledge-note {
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
}

.knowledge-note:first-child {
  padding-top: 0;
  border-top: 0;
}

.knowledge-note:last-child {
  padding-bottom: 0;
}

.knowledge-note__label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
  font-weight: 600;
}

.knowledge-note__icon {
  flex: none;
  width: 16px;
  height: 16px;
}

.knowledge-note p {
  margin: 0 0 0.35rem;
}

.knowledge-note p:last-child {
  margin-bottom: 0;
}

.knowledge-note__list {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.knowledge-note__list li + li {
  margin-top: 0.3rem;
}

.knowledge-note--warning {
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
  background: var(--danger-bg);
  border-top: 0;
  border-radius: 6px;
}

.knowledge-note--warning + .knowledge-note {
  border-top: 0;
  padding-top: 0;
}

.knowledge-note--warning .knowledge-note__label {
  color: var(--danger-text);
}

/* Screenshot names in a note jump to the picture in the article. */
.knowledge-note__image-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.knowledge-note__image-link:hover {
  color: var(--primary);
}

.knowledge-article-body img[id] {
  scroll-margin-top: calc(var(--app-header-offset, 0px) + 5rem);
}

.knowledge-article-body img:target {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

.knowledge-sidebar-muted,
.knowledge-source-panel__muted {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Upload documents drawer (knowledge_bulk_upload_controller.js): a dashed
   drop area that also opens the file picker (same dashed outline and
   --primary drag state as the compose attachments box), then one row per
   file: name, size, status badge, remove, and the reason underneath when a
   file was skipped or refused. */
.knowledge-upload__dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  margin: 0.75rem 0;
  padding: 1.5rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--surface);
  text-align: center;
  cursor: pointer;
}

.knowledge-upload__dropzone:hover {
  border-color: var(--muted);
}

.knowledge-upload__dropzone.is-dragging {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary) inset;
}

/* The drawer focuses the (hidden) file input on open, so Space / Enter opens
   the picker; the drop area shows that quietly with a --primary outline
   rather than a heavy focus ring. */
#knowledge_document_file:focus-visible + .knowledge-upload__dropzone {
  border-color: var(--primary);
}

.knowledge-upload__dropzone[hidden] {
  display: none;
}

.knowledge-upload__dropzone-title {
  color: var(--text);
  font-weight: 600;
}

.knowledge-upload__dropzone-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.knowledge-upload__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.knowledge-upload__list[hidden] {
  display: none;
}

.knowledge-upload__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  column-gap: 0.6rem;
  padding: 0.4rem 0.6rem;
}

.knowledge-upload__item + .knowledge-upload__item {
  border-top: 1px solid var(--border);
}

.knowledge-upload__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.knowledge-upload__item--skipped .knowledge-upload__name {
  color: var(--muted);
}

.knowledge-upload__size {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.knowledge-upload__remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.15rem;
  cursor: pointer;
}

.knowledge-upload__remove:hover {
  color: var(--text);
}

.knowledge-upload__reason {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.85rem;
}

.knowledge-upload__summary {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* .button sets display, which beats the hidden attribute. */
.knowledge-upload__submit[hidden] {
  display: none;
}

.knowledge-upload__summary[hidden] {
  display: none;
}

.knowledge-article-body {
  color: var(--text);
  line-height: 1.5;
}

/* "Text in image" under a pasted screenshot Claude has read
   (knowledge_article_body_html): hint / caption type (0.85rem, --muted) with a
   thin left rule tying it to the picture above. Line breaks are kept as read. */
.knowledge-image-text {
  margin: 0.35rem 0 1rem;
  padding: 0.15rem 0 0.15rem 0.6rem;
  border-left: 2px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
}

.knowledge-image-text__label {
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.knowledge-image-text__body {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.knowledge-article-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* knowledge_articles#print: the article alone, printed from a hidden frame.
   The shared .ticket-print rules supply the white page and hide the app chrome;
   these keep the body legible at the smaller print root size (same 1.15rem as
   a ticket's printed messages) and keep screenshots whole on one page. */
@media print {
  .knowledge-article-print__body {
    font-size: 1.15rem;
  }

  .knowledge-article-print__body img {
    break-inside: avoid;
    border-color: #d1d5db;
  }
}

.knowledge-standalone {
  max-width: 64rem;
  padding: 0 0 2rem;
}

/* ---------------------------------------------------------------------------
   Ask Alfred chat drawer (shared/_ask_alfred_drawer, ai_conversations/*).
   Medium drawer on the canned-response drawer shell; header, scrolling
   thread and question box stacked so the box stays at the bottom.
   --------------------------------------------------------------------------- */
.ask-alfred-drawer {
  --tickets-compact-control-height: 24px;
  z-index: 110;
}

/* Ask Alfred (beside New... in the header) shares New...'s header size above.
   The AI sparkle sits before the words and twinkles on hover. */
.app-header__ask-alfred {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-sizing: border-box;
  white-space: nowrap;
}

.app-header__ask-alfred-icon {
  flex: none;
  transform-origin: 42% 42%;
}

@media (prefers-reduced-motion: no-preference) {
  .app-header__ask-alfred:hover .app-header__ask-alfred-icon,
  .app-header__ask-alfred:focus-visible .app-header__ask-alfred-icon {
    animation: ask-alfred-twinkle 0.6s ease-in-out;
  }
}

@keyframes ask-alfred-twinkle {
  0%, 100% { transform: rotate(0) scale(1); }
  40% { transform: rotate(-12deg) scale(1.18); }
  70% { transform: rotate(6deg) scale(0.96); }
}

.ask-alfred {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.ask-alfred__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

/* The title gives way, never the buttons: a long chat title wraps onto more
   lines (it is capped at AiConversation::TITLE_MAX_LENGTH characters) while
   Pin, New chat and Close stay together on one row at the top right. */
.ask-alfred__title-block {
  flex: 1 1 auto;
  min-width: 0;
}

.ask-alfred__title {
  overflow-wrap: anywhere;
}

.ask-alfred__head .canned-response-drawer__head-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.ask-alfred__head .canned-response-drawer__head-actions .button {
  white-space: nowrap;
}

.ask-alfred__subtitle {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.ask-alfred__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 1.25rem;
}

.ask-alfred__thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ask-alfred__intro {
  margin: 0 0 1.25rem;
  color: var(--text);
  line-height: 1.5;
}

.ask-alfred__section-title {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ask-alfred__muted {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.ask-alfred__problem {
  margin: 0;
  color: var(--danger-text);
}

/* Chat list on the start page: a Pinned group, then Recent */
.ask-alfred__chat-group + .ask-alfred__chat-group {
  margin-top: 1.25rem;
}

.ask-alfred__chat-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ask-alfred__chat {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
}

.ask-alfred__chat + .ask-alfred__chat {
  border-top: 1px solid var(--border);
}

.ask-alfred__chat-link {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.ask-alfred__chat-link:hover .ask-alfred__chat-title {
  color: var(--primary);
  text-decoration: underline;
}

.ask-alfred__chat-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.ask-alfred__chat-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.ask-alfred__chat-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
}

.ask-alfred__chat-actions form,
.ask-alfred__head form,
.ask-alfred__rate-form {
  display: inline-flex;
  margin: 0;
}

.ask-alfred__pin--on,
.ask-alfred__rate--on {
  color: var(--badge-solution-text);
  background: color-mix(in srgb, var(--badge-solution-text) 12%, var(--surface));
}

/* Questions and answers */
.ask-alfred__speaker {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.ask-alfred__question {
  align-self: flex-end;
  max-width: 85%;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.ask-alfred__question p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ask-alfred__question p + p {
  margin-top: 0.5rem;
}

.ask-alfred__answer {
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.ask-alfred__answer-body {
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.ask-alfred__answer-body > :first-child {
  margin-top: 0;
}

.ask-alfred__answer-body > :last-child {
  margin-bottom: 0;
}

.ask-alfred__answer-body p,
.ask-alfred__answer-body ul,
.ask-alfred__answer-body ol,
.ask-alfred__answer-body pre,
.ask-alfred__answer-body blockquote,
.ask-alfred__answer-body table {
  margin: 0 0 0.6rem;
}

.ask-alfred__answer-body h3,
.ask-alfred__answer-body h4 {
  margin: 0.9rem 0 0.4rem;
  font-size: 0.95rem;
}

.ask-alfred__answer-body ul,
.ask-alfred__answer-body ol {
  padding-left: 1.4rem;
}

.ask-alfred__answer-body li + li {
  margin-top: 0.2rem;
}

.ask-alfred__answer-body code {
  padding: 0 0.25rem;
  border-radius: 4px;
  background: var(--bg-subtle);
  font-size: 0.85em;
}

.ask-alfred__answer-body pre {
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  background: var(--bg-subtle);
  overflow-x: auto;
}

.ask-alfred__answer-body pre code {
  padding: 0;
  background: none;
}

.ask-alfred__answer-body blockquote {
  padding-left: 0.75rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.ask-alfred__answer-body table {
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ask-alfred__answer-body th,
.ask-alfred__answer-body td {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  text-align: left;
}

.ask-alfred__cite {
  padding: 0 0.3rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary);
  font-size: 0.85em;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.ask-alfred__cite:hover {
  text-decoration: underline;
}

/* Live steps while Alfred works */
.ask-alfred__step-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.ask-alfred__step {
  color: var(--muted);
}

.ask-alfred__step--done::before {
  content: "✓ ";
  color: var(--badge-solution-text);
}

.ask-alfred__step--current {
  color: var(--text);
  animation: ask-alfred-pulse 1.4s ease-in-out infinite;
}

@keyframes ask-alfred-pulse {
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .ask-alfred__step--current { animation: none; }
}

/* Sources, rating, meta and "Show what was sent" */
.ask-alfred__sources {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.ask-alfred__source-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.ask-alfred__source-list li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.ask-alfred__source-link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ask-alfred__answer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 0.75rem;
}

.ask-alfred__feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.ask-alfred__comment {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0 0.35rem;
}

.ask-alfred__comment .ticket-details-field__input {
  width: 16rem;
  max-width: 100%;
}

.ask-alfred__meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.ask-alfred__details {
  margin-top: 0.6rem;
  font-size: 0.85rem;
}

.ask-alfred__details > summary,
.ask-alfred__call > summary {
  color: var(--muted);
  cursor: pointer;
}

.ask-alfred__details[open] > summary {
  margin-bottom: 0.5rem;
}

.ask-alfred__sent {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ask-alfred__facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 0.75rem;
  margin: 0;
}

.ask-alfred__facts dt {
  color: var(--muted);
}

.ask-alfred__facts dd {
  margin: 0;
}

.ask-alfred__pre {
  max-height: 18rem;
  margin: 0;
  padding: 0.5rem 0.65rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-subtle);
  font-size: 0.8rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ask-alfred__call + .ask-alfred__call {
  margin-top: 0.35rem;
}

.ask-alfred__call[open] > summary {
  margin-bottom: 0.35rem;
}

.ask-alfred__call .ask-alfred__pre + .ask-alfred__pre {
  margin-top: 0.35rem;
}

/* Question box: the input, with Ask beside it at the top right. */
.ask-alfred__composer {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.ask-alfred__input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 4.5rem;
  resize: vertical;
}

/* Wide enough for "Asking…", so the input does not jump when the label changes. */
.ask-alfred__ask {
  flex: 0 0 auto;
  min-width: 4.25rem;
}
