/*
 * Ticket System - Bootstrap 5 Custom Overrides
 */

/* === Status Badges === */
.badge-status-open { background-color: #dbeafe; color: #1e40af; }
.badge-status-in_progress { background-color: #fef3c7; color: #92400e; }
.badge-status-resolved { background-color: #d1fae5; color: #065f46; }
.badge-status-closed { background-color: #e5e7eb; color: #374151; }

/* === Priority Badges === */
.badge-priority-critical { background-color: #fee2e2; color: #991b1b; }
.badge-priority-high { background-color: #ffedd5; color: #9a3412; }
.badge-priority-medium { background-color: #fef3c7; color: #92400e; }
.badge-priority-low { background-color: #e5e7eb; color: #374151; }

/* === Sync Status Badges === */
.badge-sync-never { background-color: #e5e7eb; color: #374151; }
.badge-sync-syncing { background-color: #dbeafe; color: #1e40af; }
.badge-sync-synced { background-color: #d1fae5; color: #065f46; }
.badge-sync-failed { background-color: #fee2e2; color: #991b1b; }
.badge-sync-idle { background-color: #d1fae5; color: #065f46; }
.badge-sync-error { background-color: #fee2e2; color: #991b1b; }

/* === AI Review Status Badges === */
.badge-ai-pending { background-color: #e5e7eb; color: #374151; }
.badge-ai-analyzing { background-color: #dbeafe; color: #1e40af; }
.badge-ai-completed { background-color: #d1fae5; color: #065f46; }
.badge-ai-failed { background-color: #fee2e2; color: #991b1b; }

/* === Dark Mode Badge Variants === */
[data-bs-theme="dark"] .badge-status-open { background-color: #1e3a5f; color: #93c5fd; }
[data-bs-theme="dark"] .badge-status-in_progress { background-color: #4a3728; color: #fde68a; }
[data-bs-theme="dark"] .badge-status-resolved { background-color: #14432a; color: #6ee7b7; }
[data-bs-theme="dark"] .badge-status-closed { background-color: #374151; color: #9ca3af; }

[data-bs-theme="dark"] .badge-priority-critical { background-color: #4a1c1c; color: #fca5a5; }
[data-bs-theme="dark"] .badge-priority-high { background-color: #4a2c1a; color: #fdba74; }
[data-bs-theme="dark"] .badge-priority-medium { background-color: #4a3728; color: #fde68a; }
[data-bs-theme="dark"] .badge-priority-low { background-color: #374151; color: #9ca3af; }

[data-bs-theme="dark"] .badge-sync-never { background-color: #374151; color: #9ca3af; }
[data-bs-theme="dark"] .badge-sync-syncing { background-color: #1e3a5f; color: #93c5fd; }
[data-bs-theme="dark"] .badge-sync-synced,
[data-bs-theme="dark"] .badge-sync-idle { background-color: #14432a; color: #6ee7b7; }
[data-bs-theme="dark"] .badge-sync-failed,
[data-bs-theme="dark"] .badge-sync-error { background-color: #4a1c1c; color: #fca5a5; }

[data-bs-theme="dark"] .badge-ai-pending { background-color: #374151; color: #9ca3af; }
[data-bs-theme="dark"] .badge-ai-analyzing { background-color: #1e3a5f; color: #93c5fd; }
[data-bs-theme="dark"] .badge-ai-completed { background-color: #14432a; color: #6ee7b7; }
[data-bs-theme="dark"] .badge-ai-failed { background-color: #4a1c1c; color: #fca5a5; }

/* === Export Status Badges === */
.badge-export-pending { background-color: #e5e7eb; color: #374151; }
.badge-export-processing { background-color: #dbeafe; color: #1e40af; }
.badge-export-completed { background-color: #d1fae5; color: #065f46; }
.badge-export-failed { background-color: #fee2e2; color: #991b1b; }

[data-bs-theme="dark"] .badge-export-pending { background-color: #374151; color: #9ca3af; }
[data-bs-theme="dark"] .badge-export-processing { background-color: #1e3a5f; color: #93c5fd; }
[data-bs-theme="dark"] .badge-export-completed { background-color: #14432a; color: #6ee7b7; }
[data-bs-theme="dark"] .badge-export-failed { background-color: #4a1c1c; color: #fca5a5; }

/* === Bulk Select Bar === */
.bulk-select-bar {
  position: sticky;
  bottom: 0;
  background-color: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
  padding: 0.75rem 1rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  /* Its dropup menus must clear the sticky filter bar (1020), sticky table headers (1005) and the
     saved-filters row (1030); stays below the mobile sidebar overlay (1035). */
  z-index: 1032;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.bulk-select-bar .dropdown-menu {
  max-height: 50vh;
  overflow-y: auto;
}

/* === Label Badges === */
.label-badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  color: #fff;
  white-space: nowrap;
}

/* === AI Review Summary Callout === */
.ai-review-summary {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.ai-review-summary h4 {
  margin: 0 0 0.25rem;
  color: #166534;
}

[data-bs-theme="dark"] .ai-review-summary {
  background-color: #14432a;
  border-color: #166534;
}

[data-bs-theme="dark"] .ai-review-summary h4 {
  color: #6ee7b7;
}

/* === Card Hover Transitions === */
.card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-hover:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .card-hover:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* === Flash Animation === */
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert[role="alert"] {
  animation: flash-in 0.3s ease;
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
}

.empty-state .bi {
  font-size: 2.5rem;
  opacity: 0.4;
  display: block;
  margin-bottom: 0.75rem;
}

/* === Turbo Progress Bar === */
.turbo-progress-bar {
  background-color: #3b82f6;
}

/* === Stat Cards === */
.stat-card {
  text-align: center;
  color: inherit;
  transition: box-shadow 0.15s ease-in-out;
}

a.stat-card:hover {
  box-shadow: 0 .25rem .5rem rgba(0,0,0,.1);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card-highlight {
  border-color: #3b82f6 !important;
}

.stat-card-highlight .stat-value {
  color: #3b82f6;
}

[data-bs-theme="dark"] .stat-card-highlight {
  border-color: #60a5fa !important;
}

[data-bs-theme="dark"] .stat-card-highlight .stat-value {
  color: #60a5fa;
}

/* === External Link Arrow === */
.external-link::after {
  content: " \2197";
  font-size: 0.8em;
}

/* === Auth Pages === */
.auth-card {
  max-width: 420px;
  margin: 3rem auto;
}

/* === Metadata Grid === */
.metadata-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* === Form Color Input === */
.form-control-color {
  width: 50px;
  height: 38px;
  padding: 2px;
}

/* === Clickable Table Rows === */
.cursor-pointer {
  cursor: pointer;
}

.table-hover tr.cursor-pointer:hover td {
  background-color: rgba(var(--bs-primary-rgb), 0.05);
}

[data-bs-theme="dark"] .table-hover tr.cursor-pointer:hover td {
  background-color: rgba(var(--bs-primary-rgb), 0.1);
}

/* === Ticket Body === */
.ticket-body {
  line-height: 1.7;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* === Group Header (Cross-Project View) === */
.group-header {
  border-bottom: 2px solid var(--bs-border-color);
  padding-bottom: 0.5rem;
}

/* === Sidebar Layout === */
:root {
  --sidebar-width: 220px;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: #1a1d23;
  color: #c9d1d9;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1rem;
  color: #c9d1d9;
  text-decoration: none;
  font-size: 0.875rem;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-link.active {
  background-color: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.sidebar-link .bi {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5rem 0;
}

.sidebar-user {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: #8b949e;
}

.app-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* Mobile header */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1035;
}

/* Mobile responsive */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .app-content {
    margin-left: 0;
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

@media (min-width: 992px) {
  .mobile-header {
    display: none !important;
  }
}

/* Dark mode sidebar adjustment */
[data-bs-theme="dark"] .app-sidebar {
  background: #0d1117;
}

/* Print: hide sidebar */
@media print {
  .app-sidebar,
  .mobile-header,
  .sidebar-overlay {
    display: none !important;
  }

  .app-content {
    margin-left: 0 !important;
  }
}

/* === Compact Spacing Overrides === */
h1 { font-size: 1.5rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

.card-body { padding: 0.75rem; }

.table > :not(caption) > * > * {
  padding: 0.4rem 0.5rem;
}

.list-group-item {
  padding: 0.5rem 0.75rem;
}

.breadcrumb {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

/* === Tickets Sticky UI === */
.tickets-filter-sticky {
  position: sticky;
  top: var(--tickets-sticky-nav, 56px);
  z-index: 1020;
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  padding: 0.5rem 0;
}

.tickets-table-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
}

.tickets-table {
  table-layout: fixed;
  width: 100%;
}

.tickets-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tickets-sticky .tickets-table thead th {
  position: sticky;
  top: var(--tickets-sticky-nav, 56px);
  z-index: 1005;
  background: var(--bs-body-bg);
  box-shadow: inset 0 -1px 0 var(--bs-border-color);
}

/* === Column Resize Handles === */
.tickets-table th {
  position: relative;
}

.column-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  user-select: none;
}

.column-resize-handle:hover,
.column-resize-active .column-resize-handle {
  background: var(--bs-primary);
  opacity: 0.3;
}

body.column-resize-active {
  cursor: col-resize !important;
  user-select: none;
}

/* === Column Reorder and Picker === */
.tickets-table th[draggable="true"] {
  cursor: grab;
}

.tickets-table th.column-dragging {
  opacity: 0.5;
}

.column-picker {
  min-width: 14rem;
  padding: 0.5rem 0.75rem;
}

.column-picker-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.125rem 0;
}

/* === Favorite Star === */
.favorite-star {
  color: var(--bs-secondary);
  transition: color 0.15s ease;
}

.favorite-star:hover {
  color: #f59e0b;
}

/* === Preview Pagination === */
.preview-pagination {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* === Sortable Column Headers === */
.sortable-header {
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.sortable-header:hover {
  color: var(--bs-primary);
}

.sortable-header .bi {
  font-size: 0.7rem;
}

/* === Breakdown Bars (Dashboard) === */
.breakdown-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  gap: 1px;
}

.breakdown-segment {
  min-width: 4px;
  transition: flex-basis 0.3s ease;
}

.breakdown-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* === Kanban Board === */
.kanban-board {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: 400px;
}

.kanban-column {
  flex: 0 0 280px;
  background: var(--bs-tertiary-bg);
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.kanban-card-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  min-height: 60px;
  transition: background-color 0.15s ease;
}

.kanban-card {
  cursor: grab;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.5;
}

.kanban-card-list.drag-over {
  background-color: rgba(var(--bs-primary-rgb), 0.08);
  border-radius: 0.375rem;
}

/* === Inline Status Dropdown === */
.badge.dropdown-toggle {
  cursor: pointer;
}

.badge.dropdown-toggle::after {
  font-size: 0.6rem;
  vertical-align: middle;
  margin-left: 0.2rem;
  opacity: 0.6;
}

/* Fixed-position menus overlap other tables; stay above their sticky headers (1005), below the filter bar (1020). */
.tickets-table .dropdown-menu {
  --bs-dropdown-zindex: 1010;
}

/* === Keyboard Shortcut Key Cap === */
.kbd {
  display: inline-block;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.25rem;
  background: var(--bs-tertiary-bg);
  box-shadow: 0 1px 0 var(--bs-border-color);
  line-height: 1;
}

/* === FreshBooks Client Picker === */
.client-picker__menu {
  width: 320px;
  max-width: 90vw;
}

.client-picker__list {
  max-height: 17rem;
  overflow-y: auto;
}

.client-picker__item .dropdown-item {
  white-space: normal;
}

.client-picker__dot {
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  display: inline-block;
}

.client-picker__dot.is-active {
  background-color: var(--bs-success);
  box-shadow: 0 0 0 0.15rem rgba(var(--bs-success-rgb), 0.18);
}

.client-picker__dot.is-archived {
  background-color: var(--bs-secondary-color);
  opacity: 0.55;
}

/* === Mentions === */
.mention {
  color: var(--bs-primary);
  font-weight: 600;
}

.mention-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1050;
  min-width: 16rem;
  max-width: 100%;
}

.source-ticket-panel { border-left: 3px solid #c08321; }

/* Personal workspace */
.desk-page { max-width: 1280px; margin: 1rem auto 0; }
.desk-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.desk-heading h1 { font-size: 1.75rem; font-weight: 650; letter-spacing: -.04em; margin: 0; }
.desk-heading p { color: var(--bs-secondary-color); margin: .4rem 0 0; font-size: .9rem; }
.desk-heading > .btn { flex-shrink: 0; }
.desk-tabs { display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; border-bottom: 1px solid var(--bs-border-color); }
.desk-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .8rem 0; border-bottom: 2px solid transparent; color: var(--bs-secondary-color); font-size: .875rem; text-decoration: none; }
.desk-tab:hover { color: var(--bs-primary-text-emphasis); }
.desk-tab.active { border-bottom-color: var(--bs-primary); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.desk-tab-count { font-variant-numeric: tabular-nums; }
.desk-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding-top: 1rem; }
.desk-filter-search { position: relative; flex: 1 1 16rem; min-width: 0; }
.desk-filter-search .bi-search { position: absolute; top: 50%; left: .65rem; transform: translateY(-50%); color: var(--bs-secondary-color); font-size: .8rem; pointer-events: none; }
.desk-filter-search .form-control { padding-left: 1.85rem; }
.desk-filters .form-select { flex: 0 1 11rem; width: auto; min-width: 0; }
.desk-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; }
.desk-quiet-button { color: var(--bs-secondary-color); border: 1px solid var(--bs-border-color); white-space: nowrap; }
.desk-quiet-button:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); border-color: var(--bs-secondary-color); }
.desk-quiet-button:disabled { border-color: var(--bs-border-color); color: var(--bs-secondary-color); opacity: .4; }
.desk-ticket { display: grid; grid-template-columns: 14px minmax(0, 1fr) minmax(115px, auto) 36px; align-items: start; gap: .75rem; padding: 1.1rem 0; border-bottom: 1px solid var(--bs-border-color); }
.desk-ticket-main { min-width: 0; }
.desk-ticket-title { color: var(--bs-body-color); text-decoration: none; font-size: .95rem; font-weight: 500; overflow-wrap: anywhere; }
.desk-ticket-title:hover { color: var(--bs-primary-text-emphasis); text-decoration: underline; }
.desk-ticket-unread .desk-ticket-title { font-weight: 650; }
.desk-unread-indicator { color: var(--bs-primary); padding-top: .4rem; font-size: .45rem; }
.desk-ticket-meta { display: flex; flex-wrap: wrap; gap: .25rem .85rem; color: var(--bs-secondary-color); font-size: .78rem; margin-top: .35rem; overflow-wrap: anywhere; }
.desk-assignment { color: var(--bs-warning-text-emphasis); }
.desk-ticket-state { font-size: .78rem; text-align: right; line-height: 1.8; }
.desk-ticket-priority { color: var(--bs-secondary-color); }
.desk-urgent { color: var(--bs-danger-text-emphasis); }
.desk-flag { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--bs-secondary-color); }
.desk-flag:hover { background: var(--bs-tertiary-bg); }
.desk-flag.is-flagged { color: var(--bs-warning-text-emphasis); }
.desk-reorder { grid-column: 2 / -1; display: flex; justify-content: flex-end; gap: .5rem; }
.desk-project-group + .desk-project-group { margin-top: 1.75rem; }
.desk-project-header { display: flex; align-items: center; gap: .6rem; margin-top: .75rem; }
.desk-project-name { font-size: .95rem; font-weight: 650; margin: 0; overflow-wrap: anywhere; }
.desk-project-continued { color: var(--bs-secondary-color); font-size: .78rem; }
.desk-project-reorder { display: flex; gap: .35rem; margin-left: auto; }
.desk-footer { display: flex; flex-wrap: wrap; gap: .7rem 1.5rem; align-items: baseline; color: var(--bs-secondary-color); font-size: .78rem; margin-top: 1.5rem; }
.desk-footer a { color: inherit; }
.desk-footer details { margin-left: auto; max-width: 400px; }
.desk-footer details p { margin: .6rem 0 0; }
.desk-empty { padding: 3.5rem 1rem; text-align: center; }
.desk-empty > i { display: block; color: var(--bs-secondary-color); font-size: 1.75rem; margin-bottom: 1rem; }
.team-workload-list { max-width: 700px; }
.team-workload-member { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--bs-border-color); color: var(--bs-body-color); text-decoration: none; }
.team-workload-member:hover { color: var(--bs-primary); }
.team-workload-member > span:last-child { color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Keep everyday navigation ahead of administration. */
:root { --sidebar-width: 190px; }
.app-sidebar, [data-bs-theme="dark"] .app-sidebar { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.sidebar-brand, .sidebar-footer { border-color: var(--bs-border-color); }
.sidebar-link { color: var(--bs-secondary-color); padding-block: .65rem; }
.sidebar-link:hover { color: var(--bs-body-color); background: var(--bs-secondary-bg); }
.sidebar-link.active { color: var(--bs-primary-text-emphasis); background: rgba(var(--bs-primary-rgb), .1); }
.sidebar-user { color: var(--bs-secondary-color); }
.sidebar-settings > summary { list-style: none; }
.sidebar-settings > summary::-webkit-details-marker { display: none; }
.sidebar-settings[open] > summary .bi-chevron-down { transform: rotate(180deg); }
.sidebar-settings nav .sidebar-link { padding-left: 2.85rem; font-size: .8rem; }

@media (max-width: 575px) {
  .desk-page { margin-top: .5rem; }
  .desk-heading { align-items: start; gap: .75rem; margin-bottom: 1.4rem; }
  .desk-heading h1 { font-size: 1.5rem; }
  .desk-heading p { font-size: .82rem; }
  .desk-heading > .btn { font-size: .8rem; padding: .55rem .65rem; }
  .desk-tabs { gap: 0 1.1rem; }
  .desk-tab { font-size: .8rem; min-height: 44px; }
  /* Search and Clear share the first row so both selects get half a row. */
  .desk-filter-search { flex: 1 1 calc(100% - 6rem); }
  .desk-filters > .desk-quiet-button { order: 1; }
  .desk-filters .form-select { order: 2; flex: 1 1 calc(50% - .25rem); min-height: 44px; }
  .desk-filter-search .form-control { min-height: 44px; }
  .desk-toolbar { align-items: start; gap: .5rem; }
  .desk-toolbar > span { font-size: .75rem; }
  .desk-ticket { grid-template-columns: 8px minmax(0, 1fr) 40px; column-gap: .65rem; row-gap: .5rem; }
  .desk-ticket > form { grid-column: 3; grid-row: 1 / 3; }
  .desk-ticket-state { grid-column: 2; display: flex; flex-wrap: wrap; gap: 0 .75rem; text-align: left; }
  .desk-reorder { grid-column: 2 / -1; flex-wrap: wrap; }
  .desk-flag { width: 40px; height: 44px; }
  .desk-footer { gap: .7rem 1rem; }
  .desk-footer details { margin-left: 0; flex-basis: 100%; }
}
@media (pointer: coarse) {
  .desk-quiet-button, .desk-reorder .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .desk-flag { min-height: 44px; }
}

/* Quiet follow-up controls and conversation search results. */
.ticket-follow-up { font-size: .78rem; margin-top: .55rem; color: var(--bs-secondary-color); }
.ticket-follow-up summary { width: fit-content; }
.follow-up-controls { background: var(--bs-tertiary-bg); border-radius: 6px; padding: .85rem; margin-top: .65rem; max-width: 440px; }
.follow-up-controls input[type="date"] { max-width: 100%; }
.integration-health { border-left: 3px solid var(--bs-warning-text-emphasis); padding: .65rem 1rem; font-size: .875rem; }
.integration-health > summary { color: var(--bs-warning-text-emphasis); }
.comment-search-match { max-width: 65ch; overflow-wrap: anywhere; white-space: normal; }
.comment-search-match a { text-decoration: none; }
.comment-search-match a:hover { text-decoration: underline; }
[id^="comment_"]:target { outline: 2px solid var(--bs-primary-text-emphasis); scroll-margin-top: 75px; }

/* Previous / Next above a ticket opened from a list. */
.ticket-pager { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.ticket-pager[hidden] { display: none; }
