/* Vercel Dashboard Layout with Light/Dark Theme Support */
:root {
  /* Light theme (default) - Bravenet brand blue #0371b7 */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F0F4F9;
  --bg-header: #F0F4F9;
  --bg-nav: #E8EEF5;
  --bg-card: #FFFFFF;
  --text-primary: #1A202C;
  --text-secondary: #4A5568;
  --text-muted: #718096;
  --border: #CBD5E0;
  --accent: #0371b7;
  --accent-hover: #025a94;
  --accent-light: #E3F2FC;
  --hover-bg: rgba(3, 113, 183, 0.08);
  --shadow: rgba(0, 0, 0, 0.08);
}
/* Dark theme */
[data-theme="dark"] {
  --bg-primary: #1E1E1E;
  --bg-secondary: #282828;
  --bg-header: #252530;
  --bg-nav: #2A2A36;
  --bg-card: #282828;
  --text-primary: #E2E8F0;
  --text-secondary: #A0AEC0;
  --text-muted: #718096;
  --border: #3E3E42;
  --accent: #0390e0;
  --accent-hover: #5bb3ed;
  --accent-light: rgba(3, 113, 183, 0.2);
  --hover-bg: rgba(3, 113, 183, 0.12);
  --shadow: rgba(0, 0, 0, 0.3);
}
/* System preference detection - only apply when theme is set to 'auto' */
[data-theme="auto"] {
  /* Will be overridden by media query if system prefers dark */
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg-primary: #1E1E1E;
    --bg-secondary: #282828;
    --bg-header: #252530;
    --bg-nav: #2A2A36;
    --bg-card: #282828;
    --text-primary: #E2E8F0;
    --text-secondary: #A0AEC0;
    --text-muted: #718096;
    --border: #3E3E42;
    --accent: #0390e0;
    --accent-hover: #5bb3ed;
    --accent-light: rgba(3, 113, 183, 0.2);
    --hover-bg: rgba(3, 113, 183, 0.12);
    --shadow: rgba(0, 0, 0, 0.3);
  }
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
/* Header */
.app-header-wrapper {
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  height: 56px;
}
.header-left {
  display: flex;
  align-items: stretch;
  gap: 16px;
  flex: 1;
  min-width: 0;
  height: 100%;
  padding-left: 24px;
}
.header-nav {
  display: flex;
  align-items: stretch;
  min-width: 0;
  overflow-x: auto;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.header-nav-item {
  padding: 0 14px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
}
.header-nav-item:hover {
  color: var(--accent);
}
.header-nav-item.active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}
.header-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: opacity 0.15s;
}
.header-logo-link:hover {
  opacity: 0.8;
}
.header-logo-img {
  height: 32px;
  width: auto;
  display: block;
}
.header-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}
.header-icon:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}
.header-icon svg {
  width: 20px;
  height: 20px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding-right: 24px;
}
.header-search {
  position: relative;
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  gap: 8px;
  min-width: 200px;
  margin: 0;
}
.header-search svg {
  color: inherit;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.header-search-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}
.header-search-submit:hover {
  color: var(--accent);
}
.header-search input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  flex: 1;
  outline: none;
  padding: 0;
}
.header-search input::-moz-placeholder {
  color: var(--text-muted);
}
.header-search input::placeholder {
  color: var(--text-muted);
}
.search-shortcut {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--text-secondary);
  font-family: monospace;
  line-height: 1.2;
}
.header-action-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.header-action-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}
.header-icon-btn {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  padding: 0;
  text-decoration: none;
}
.header-icon-btn:hover {
  background-color: var(--accent-light);
  color: var(--accent);
}
.header-icon-btn svg {
  width: 18px;
  height: 18px;
}
.header-notifications {
  position: relative;
}
.header-icon-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #d64545;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 2px solid var(--bg-card, #fff);
  box-sizing: border-box;
  pointer-events: none;
}
.header-notifications-menu {
  right: 0;
  min-width: 280px;
}
.user-menu-notification-empty {
  margin: 0;
  padding: 8px 16px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
.user-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
  border: none;
  overflow: visible;
  padding: 0;
}
.user-avatar img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  border-radius: 50%;
  /* Avoid Chrome border-radius + scale chroma smearing on small photos */
  transform: translateZ(0);
  backface-visibility: hidden;
}
.user-avatar:hover {
  opacity: 0.9;
}
.user-menu-notifications {
  padding: 4px 0 8px;
  max-height: 280px;
  overflow-y: auto;
}
.user-menu-notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.user-menu-notifications-clear {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.user-menu-notification-form {
  margin: 0;
  width: 100%;
}
.user-menu-notification-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 8px 16px 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
}
.user-menu-notification-item:hover {
  background-color: var(--hover-bg);
}
.user-menu-notification-body {
  padding: 0 16px 8px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.header-user {
  position: relative;
}
.user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow);
  width: 260px;
  z-index: 1000;
  overflow: hidden;
}
.user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.user-menu-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.user-menu-avatar img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.user-menu-avatar:not(:has(img)) {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-menu-header-text {
  min-width: 0;
}
.user-menu-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}
.user-menu-email {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-role {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.15s;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
}
.user-menu-item:hover {
  background-color: var(--hover-bg);
}
.user-menu-item svg {
  flex-shrink: 0;
}
.user-menu-divider {
  height: 1px;
  background-color: var(--border);
  margin: 4px 0;
}
.user-menu-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
}
.user-menu-switch:hover {
  background-color: var(--hover-bg);
}
.user-menu-switch-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-menu-switch-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.user-menu-switch-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.user-menu-switch-meta {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Nav bar Settings dropdown */
.nav-dropdown-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 20px;
  height: 100%;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
  position: relative;
}
.nav-dropdown-trigger:hover {
  color: var(--text-primary);
}
.nav-dropdown-trigger.active {
  color: var(--text-primary);
  font-weight: 500;
}
.nav-dropdown-chevron {
  flex-shrink: 0;
  opacity: 0.8;
}
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow);
  min-width: 180px;
  z-index: 1000;
  overflow: hidden;
  padding: 6px 0;
}
.nav-dropdown-item {
  display: block;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.15s;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
}
.nav-dropdown-item:hover {
  background-color: var(--hover-bg);
}
form.nav-dropdown-item {
  margin: 0;
  padding: 0;
}
form.nav-dropdown-item button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 14px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
form.nav-dropdown-item button:hover {
  background-color: var(--hover-bg);
}
/* Main Content */
.app-main {
  flex: 1;
  background-color: var(--bg-primary);
  overflow-y: auto;
}
/* Keeps header/main/footer in the same flex column body used to own directly. */
.app-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
body.ticket-workspace,
body.tickets-inbox {
  /* 100vh on mobile Firefox/Chrome includes browser chrome the page can't use,
     so the last tickets / reply sheet sit below the visible viewport. */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.ticket-workspace .app-shell,
body.tickets-inbox .app-shell {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
body.ticket-workspace .app-footer,
body.tickets-inbox .app-footer {
  display: none;
}
body.ticket-workspace .app-main,
body.tickets-inbox .app-main {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.ticket-workspace .page-container,
body.tickets-inbox .page-container {
  flex: 1;
  min-height: 0;
  max-width: none;
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
}
body.ticket-workspace .page-container > .alert,
body.tickets-inbox .page-container > .alert {
  margin: 12px 24px 0;
  flex-shrink: 0;
}
.tickets-main > .alert {
  margin: 0 0 12px;
  flex-shrink: 0;
}
.tickets-main > .alert.system-notice {
  margin-bottom: 12px;
}
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 40px;
}
/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.page-header p {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
  margin: 0;
}
/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}
/* Bulk actions bar - shown above the tickets table when rows are selected */
.bulk-actions-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 12px;
  background-color: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 8px;
}
.bulk-actions-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-right: auto;
}
.bulk-actions-bar select {
  width: auto;
}
/* Tickets Table - Compact Zendesk/Freshdesk Style */
.tickets-table-card {
  padding: 0;
  overflow: hidden;
}
.ticket-select-cell {
  text-align: center;
}
.ticket-select-cell input[type="checkbox"],
.tickets-table th input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}
.tickets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tickets-table thead {
  background-color: var(--bg-nav);
  border-bottom: 2px solid var(--border);
}
.tickets-table th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}
.tickets-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.1s;
}
/* Main ticket list: no alternating stripe so follow-up/stale row colors stay distinct */
.tickets-table tbody.tickets-tbody-main tr {
  background-color: var(--bg-primary);
}
/* Pinned (follow-up) section: separate tbody above main list */
.tickets-table tbody.tickets-tbody-pinned {
  background-color: rgba(3, 113, 183, 0.1);
}
.tickets-table tbody.tickets-tbody-pinned tr:last-child {
  border-bottom: 2px solid var(--border);
}
.ticket-row-clickable {
  cursor: pointer;
}
.ticket-row-clickable:hover {
  background-color: rgba(3, 113, 183, 0.12);
}
/* Follow-up and stale (legacy-style row colors) */
.ticket-row-followup {
  background-color: rgba(74, 158, 255, 0.12);
}
.ticket-row-followup:hover {
  background-color: rgba(74, 158, 255, 0.18);
}
.ticket-row-followup-stale {
  background-color: rgba(44, 110, 180, 0.2);
}
.ticket-row-followup-stale:hover {
  background-color: rgba(44, 110, 180, 0.28);
}
.ticket-row-deleted {
  background-color: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
}
.ticket-row-deleted:hover {
  background-color: rgba(0, 0, 0, 0.08);
}
.ticket-row-deleted .ticket-link,
.ticket-row-deleted .ticket-subject,
.ticket-row-deleted .ticket-summary {
  color: var(--text-secondary);
}
.ticket-row-permanently-deleted {
  background-color: rgba(255, 193, 7, 0.15);
}
.ticket-row-permanently-deleted:hover {
  background-color: rgba(255, 193, 7, 0.22);
}
.tickets-table tbody tr:last-child {
  border-bottom: none;
}
.tickets-table td {
  padding: 8px 12px;
  vertical-align: middle;
}
.admin-user-actions-cell {
  white-space: nowrap;
  text-align: right;
}
.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}
.admin-user-actions form {
  display: inline-block;
  margin: 0;
}
.ticket-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
}
.ticket-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.ticket-subject,
.ticket-summary {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}
.ticket-summary-subject {
  font-weight: 500;
  color: var(--text-primary);
}
.ticket-summary-meta {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket-row-priority-high {
  background-color: rgba(225, 29, 72, 0.04);
}
.ticket-row-priority-high:hover {
  background-color: rgba(225, 29, 72, 0.08);
}
.ticket-requester {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}
.ticket-date {
  color: var(--text-primary);
  font-size: 13px;
}
.ticket-assigned {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}
.ticket-assigned-empty {
  color: var(--text-muted);
  font-weight: 400;
}
.ticket-summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ticket-summary-row .ticket-summary {
  min-width: 0;
  flex: 1;
}
.ticket-row-unread .ticket-summary-subject {
  font-weight: 700;
}
.ticket-replies-cell {
  text-align: center;
}
.ticket-replies-count {
  display: inline-block;
  min-width: 1.5em;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.ticket-subject-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket-requester-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ticket-list-avatar {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
}
.ticket-list-avatar-initials {
  line-height: 1;
}
.ticket-updated-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ticket-last-by {
  font-size: 11px;
  color: var(--text-muted);
}
/* Tickets list empty state */
.tickets-empty-state {
  text-align: center;
  padding: 48px 24px;
}
.tickets-empty-state-icon {
  color: var(--text-muted);
  margin-bottom: 16px;
}
.tickets-empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}
.tickets-empty-state-hint {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 24px 0;
}
.tickets-empty-state-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
/* Ticket View - Freshdesk Style */
.ticket-view-freshdesk {
  max-width: 1400px;
  margin: 0 auto;
}
.ticket-view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.ticket-view-header-left {
  flex: 1;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 12px;
  transition: color 0.15s;
}
.back-link:hover {
  color: var(--text-primary);
}
.back-link svg {
  width: 16px;
  height: 16px;
}
.ticket-title-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ticket-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ticket-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.ticket-title-copy {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ticket-title-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
}
.ticket-title-copy-btn:hover,
.ticket-title-copy-btn:focus-visible {
  color: var(--accent, #2563eb);
}
.ticket-title-copy-btn:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 3px;
}
.ticket-title-copy-icon {
  opacity: 0.45;
  flex-shrink: 0;
}
.ticket-title-copy-btn:hover .ticket-title-copy-icon,
.ticket-title-copy-btn:focus-visible .ticket-title-copy-icon {
  opacity: 0.9;
}
.ticket-title-copied {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.ticket-view-subject {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
  max-width: 720px;
}
.ticket-badges {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ticket-reply-count-badge {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.ticket-view-header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ticket-view-content {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
}
/* Conversation Thread */
.ticket-conversation {
  min-width: 0;
}
/* Scroll to bottom FAB (long ticket threads) */
.scroll-to-bottom-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  transition: background-color 0.15s, transform 0.15s;
}
.scroll-to-bottom-fab:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}
.scroll-to-bottom-fab:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.4);
}
.scroll-to-bottom-fab[hidden] {
  display: none;
}
/* Freshdesk/Discourse-style card layout: each message is a distinct card for easier scanning */
.conversation-item {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  background: var(--bg-card);
  transition: box-shadow 0.15s ease;
}
.conversation-item:hover {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
/* Per-author colors: each unique person (customer, Agent A, Agent B, …) gets a distinct tint + left border */
.conversation-item-author-0 {
  background: var(--bg-card);
  border-left-color: #94a3b8;
}
.conversation-item-author-1 {
  background: rgba(74, 158, 255, 0.08);
  border-left-color: var(--accent);
}
.conversation-item-author-2 {
  background: rgba(34, 197, 94, 0.08);
  border-left-color: #22c55e;
}
.conversation-item-author-3 {
  background: rgba(234, 179, 8, 0.1);
  border-left-color: #eab308;
}
.conversation-item-author-4 {
  background: rgba(168, 85, 247, 0.08);
  border-left-color: #a855f7;
}
.conversation-item-author-5 {
  background: rgba(20, 184, 166, 0.08);
  border-left-color: #14b8a6;
}
/* Remove extra margin on last message (reply form follows) */
.ticket-conversation-messages .conversation-item:last-child {
  margin-bottom: 0;
}
.conversation-item-initial {
  padding-top: 16px;
}
.conversation-item-internal {
  position: relative;
  background-color: rgba(255, 243, 224, 0.5);
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 152, 0, 0.2);
  border-bottom: 1px solid rgba(255, 152, 0, 0.2); /* keep bottom border on every message including last */
  margin-left: 48px;
  margin-bottom: 12px;
}
.conversation-item-internal:last-child {
  margin-bottom: 0;
}
/* System events: neutral, less prominent (Zendesk-style: internal = warm, system = gray) */
.conversation-item-internal-system {
  background-color: var(--bg-secondary);
  border-color: var(--border);
  border-bottom-color: var(--border);
}
/* Timeline line */
.internal-comments-timeline {
  position: relative;
  padding-left: 8px;
}
.internal-comments-timeline .conversation-item-internal {
  padding-left: 20px;
}
.internal-comment-marker {
  position: absolute;
  left: -40px;
  top: 24px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent);
  border: 2px solid var(--bg-card);
  box-sizing: border-box;
}
.conversation-item-internal-system .internal-comment-marker {
  background-color: var(--text-muted);
}
.conversation-avatar-system {
  background: var(--bg-secondary);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.conversation-avatar-system .avatar-icon-system {
  flex-shrink: 0;
}
.internal-comment-body {
  font-size: 14px;
  line-height: 1.55;
}
.internal-comment-body p:last-child {
  margin-bottom: 0;
}
.conversation-avatar {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
}
.conversation-avatar .avatar-initials {
  width: 100%;
  height: 100%;
}
.conversation-avatar .avatar-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  display: block;
}
.avatar-initials {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.conversation-content {
  flex: 1;
  min-width: 0;
}
.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}
.conversation-author {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.conversation-author strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.conversation-email {
  font-size: 13px;
  color: var(--text-secondary);
}
.conversation-badge-staff {
  display: inline-block;
  padding: 2px 8px;
  background-color: rgba(74, 158, 255, 0.15);
  color: var(--accent);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.conversation-badge-internal {
  display: inline-block;
  padding: 2px 8px;
  background-color: rgba(255, 152, 0, 0.2);
  color: #e65100;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.conversation-item-internal-system .conversation-badge-internal {
  background-color: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
}
.conversation-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.conversation-date {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1.2;
}
/* Edit is a <button>; Delete is button_to → <form><button/input>. Match box model so baselines line up. */
.conversation-edit-link {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--link-color, #2563eb);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  display: inline-flex;
  align-items: center;
  height: 1.2em;
  box-sizing: content-box;
}
.conversation-edit-link:hover {
  color: var(--link-hover, #1d4ed8);
}
.conversation-delete-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: none;
  line-height: 0;
}
.conversation-delete-link {
  color: #c62828;
}
.conversation-delete-link:hover {
  color: #b71c1c;
}
.conversation-body-editable {
  cursor: text;
}
.reply-inline-edit {
  margin-top: 4px;
}
.reply-inline-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.conversation-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.conversation-body {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.65;
  word-wrap: break-word;
}
.conversation-body p {
  margin: 0 0 12px 0;
}
.conversation-body p:last-child {
  margin-bottom: 0;
}
/* Expandable long message body — hairline "show more" divider when content overflows */
.conversation-body-expandable {
  position: relative;
}
.conversation-body-expandable .conversation-body.is-clamped {
  max-height: 320px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, black 0%, black 75%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 75%, transparent 100%);
}
.conversation-body-expand-btn {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
/* Author CSS `display` would otherwise override the HTML hidden attribute. */
.conversation-body-expand-btn[hidden] {
  display: none !important;
}
.conversation-body-expand-btn::before,
.conversation-body-expand-btn::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--border, rgba(0, 0, 0, 0.12));
}
.conversation-body-expand-btn:hover {
  color: var(--accent);
}
.conversation-body-expand-btn:hover::before,
.conversation-body-expand-btn:hover::after {
  background: rgba(74, 158, 255, 0.45);
}
.conversation-body-expand-label {
  flex: 0 0 auto;
  white-space: nowrap;
}
/* Reply Form */
.conversation-reply {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid var(--border);
}
.conversation-reply-form {
  flex: 1;
  min-width: 0;
}
.reply-textarea {
  min-height: 120px;
  resize: vertical;
}
.reply-canned-picker {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.reply-canned-trigger {
  white-space: nowrap;
}
.reply-canned-modal .modal-content.reply-canned-modal-content {
  max-width: 640px;
  width: min(640px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
}
.reply-canned-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.reply-canned-search {
  width: 100%;
  flex-shrink: 0;
}
.reply-canned-results {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 4px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.reply-canned-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
}
.reply-canned-result + .reply-canned-result {
  margin-top: 2px;
}
.reply-canned-result:hover,
.reply-canned-result:focus {
  background: rgba(3, 113, 183, 0.08);
  outline: none;
}
.reply-canned-result-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}
.reply-canned-result-meta {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.reply-canned-empty {
  padding: 24px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}
.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;
}
.reply-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.reply-form-options {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.reply-frame-pickers {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.reply-signature-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.reply-signature-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.reply-signature-select {
  width: auto;
  min-width: 120px;
  max-width: 160px;
}
.reply-form-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.checkbox-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: normal;
  margin: 0;
  cursor: pointer;
}
/* Badge Count */
.badge-count {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  background-color: var(--bg-secondary);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.modal-open {
  display: flex;
}
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 1001;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s;
}
.modal-close:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}
.modal-close svg {
  width: 20px;
  height: 20px;
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.modal-footer,
.confirm-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border-color, #e5e7eb);
}
.confirm-dialog-content {
  max-width: 440px;
  width: 100%;
}
.confirm-dialog-message {
  margin: 0;
  color: var(--text-secondary, #4b5563);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.ticket-deleted-banner {
  padding: 16px 20px;
  background: var(--bg-secondary, #f9fafb);
  border-top: 1px solid var(--border-color, #e5e7eb);
}
.ticket-deleted-banner p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary, #4b5563);
}
.modal-comments-list {
  margin-bottom: 24px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}
.modal-comments-list::-webkit-scrollbar {
  width: 6px;
}
.modal-comments-list::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 3px;
}
.modal-comments-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.modal-comments-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
.modal-comments-form {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.internal-comments-modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.internal-comments-modal-body .modal-comments-list {
  flex: 1;
  min-height: 200px;
  max-height: 50vh;
}
.internal-comments-form {
  flex-shrink: 0;
}
.internal-comments-form-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
}
.internal-comments-empty {
  text-align: center;
  padding: 48px 24px;
}
.internal-comments-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}
.internal-comments-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}
.internal-comments-empty-hint {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.5;
}
/* Internal Comments Section (kept for backward compatibility) */
.conversation-section-internal {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid var(--border);
}
.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.section-header h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}
.section-header svg {
  color: var(--text-secondary);
}
.empty-state {
  color: var(--text-secondary);
  font-size: 14px;
  font-style: italic;
  margin: 16px 0;
}
.comment-form {
  margin-top: 20px;
}
/* Sidebar - Freshdesk Style */
.ticket-sidebar-freshdesk {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sidebar-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}
.sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ticket-attachments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ticket-attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.ticket-attachment-link {
  flex: 1;
  min-width: 0;
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ticket-attachment-link:hover {
  text-decoration: underline;
}
.ticket-attachment-delete {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.ticket-attachment-delete:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.sidebar-muted {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.sidebar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}
.sidebar-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sidebar-attachment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-attachment-list a {
  color: var(--link-color, #2563eb);
  word-break: break-all;
  font-size: 13px;
}
.sidebar-link {
  color: var(--accent);
  text-decoration: none;
}
.sidebar-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.sidebar-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-block {
  width: 100%;
  justify-content: center;
}
.form-control-sm {
  padding: 6px 10px;
  font-size: 13px;
}
.dept-priority-form {
  display: inline-block;
  margin: 0;
}
.dept-priority-form .form-control {
  width: 7.5rem;
  max-width: 7.5rem;
}
.inline-form {
  display: flex;
  width: 100%;
  gap: 8px;
}
.inline-form .form-control {
  flex: 1;
}
.inline-form .form-control-sm {
  padding: 6px 10px;
  font-size: 13px;
}
.status-indicator {
  font-size: 13px;
  font-weight: 500;
}
.status-viewed {
  color: #81C784;
}
.status-unread {
  color: #EF5350;
}
/* Sidebar contact card (Freshdesk-style) */
.sidebar-contact-card .contact-card-header {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
}
.contact-card-avatar {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  overflow: hidden;
}
.contact-card-initials {
  line-height: 1;
  position: relative;
  z-index: 0;
}
.contact-card-avatar-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  -o-object-fit: cover;
     object-fit: cover;
  display: block;
}
.contact-card-primary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.contact-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.contact-card-email {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
.contact-card-email:hover {
  text-decoration: underline;
}
.contact-card-tickets-link {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  margin-top: 2px;
}
.contact-card-tickets-link:hover {
  color: var(--accent);
  text-decoration: underline;
}
.contact-card-ticket-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  margin-top: 4px;
}
.contact-card-tickets-by {
  font-size: 12px;
  color: var(--text-secondary);
}
.contact-card-view-all {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  margin-top: 6px;
  font-weight: 500;
}
.contact-card-view-all:hover {
  text-decoration: underline;
}
.sidebar-contact-card .contact-card-details {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
/* Sidebar visual timeline */
.sidebar-timeline-section .sidebar-title {
  margin-bottom: 12px;
}
.sidebar-timeline {
  position: relative;
  padding-left: 20px;
}
.sidebar-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}
.sidebar-timeline-item {
  position: relative;
  padding-bottom: 14px;
}
.sidebar-timeline-item:last-child {
  padding-bottom: 0;
}
.sidebar-timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  box-sizing: border-box;
}
.sidebar-timeline-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-timeline-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  font-weight: 500;
}
.sidebar-timeline-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}
.sidebar-timeline-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
/* Agent ticket workspace: conversation pane + docked composer */
.ticket-view-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.ticket-view-workspace .ticket-view-freshdesk {
  max-width: none;
  margin: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.ticket-view-workspace .ticket-view-header {
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 8px 24px;
  align-items: center;
  gap: 16px;
}
.ticket-view-workspace .ticket-view-header-right {
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.ticket-view-workspace .ticket-header-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.ticket-view-workspace .header-toolbar-split {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
  align-self: center;
}
.ticket-view-workspace .header-action-form,
.ticket-view-workspace .ticket-view-header-right .button_to {
  margin: 0;
  display: inline-flex;
  align-items: center;
}
/* One height for Unfollow / Notes / Close / Delete / Back / Internal Comments
   (submit, link, button_to, and icon+badge variants were otherwise uneven). */
.ticket-view-workspace .ticket-view-header-right .btn {
  box-sizing: border-box;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  line-height: 1;
  font-size: 13px;
  font-weight: 500;
  gap: 6px;
}
.ticket-view-workspace .ticket-view-header-right .btn svg {
  width: 14px;
  height: 14px;
  margin: 0 !important;
  flex-shrink: 0;
}
.ticket-view-workspace .ticket-view-header-right .badge-count {
  margin-left: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: inherit;
}
.ticket-view-workspace .ticket-title {
  font-size: 20px;
}
.ticket-view-workspace .ticket-view-subject {
  margin-top: 2px;
}
.ticket-view-workspace .typing-indicator-banner {
  flex-shrink: 0;
  margin: 8px 24px 0;
  border-radius: 6px;
}
.ticket-view-workspace .ticket-view-content {
  flex: 1;
  min-height: 0;
  gap: 0;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) var(--ticket-sidebar-width, 400px);
}
.ticket-view-workspace .ticket-conversation {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.ticket-conversation-pane {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.ticket-view-workspace .ticket-conversation-messages {
  height: 100%;
  overflow-y: auto;
  padding: 16px 24px 20px;
}
.ticket-view-workspace .conversation-reply {
  position: relative;
  flex: 0 0 auto;
  height: var(--ticket-reply-height, 320px);
  min-height: 180px;
  max-height: min(70vh, 720px);
  margin-top: 0;
  padding: 14px 20px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
  display: flex;
  gap: 16px;
  align-items: stretch;
}
.ticket-view-workspace .reply-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  z-index: 5;
  touch-action: none;
}
.ticket-view-workspace .reply-resize-handle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 50%;
  width: 36px;
  height: 3px;
  margin-left: -18px;
  border-radius: 999px;
  background: var(--border);
  opacity: 0.85;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.ticket-view-workspace .reply-resize-handle:hover::after,
.ticket-view-workspace .reply-resize-handle:focus-visible::after,
body.reply-resizing .ticket-view-workspace .reply-resize-handle::after {
  background: var(--accent);
  opacity: 1;
}
body.reply-resizing {
  cursor: ns-resize;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
body.reply-resizing .CodeMirror {
  pointer-events: none;
}
.ticket-view-workspace .conversation-reply-form {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ticket-view-workspace .conversation-reply-form > form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ticket-view-workspace .conversation-reply-form .form-group {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ticket-view-workspace .conversation-reply .EasyMDEContainer {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ticket-view-workspace .conversation-reply .editor-toolbar {
  flex-shrink: 0;
}
.ticket-view-workspace .conversation-reply .EasyMDEContainer .CodeMirror {
  flex: 1 1 auto;
  min-height: 88px;
  max-height: none;
  /* Fixed pane height (not auto) so CodeMirror can scroll long replies. */
  height: 100% !important;
  overflow: hidden;
}
.ticket-view-workspace .conversation-reply .EasyMDEContainer .CodeMirror-scroll {
  min-height: 100% !important;
}
.ticket-view-workspace .conversation-reply .reply-form-actions {
  flex-shrink: 0;
  margin-top: 10px;
}
/* EasyMDE fullscreen must escape the compact reply pane */
.ticket-view-workspace .conversation-reply .EasyMDEContainer .CodeMirror-fullscreen,
.EasyMDEContainer .CodeMirror-fullscreen {
  max-height: none !important;
  min-height: 0 !important;
  height: auto !important;
  z-index: 10050 !important;
}
.editor-toolbar.fullscreen {
  z-index: 10051 !important;
}
.editor-preview-side.fullscreen,
.CodeMirror-fullscreen + .editor-preview {
  z-index: 10050 !important;
}
.ticket-view-workspace .conversation-reply .editor-statusbar {
  display: none;
}
.ticket-view-workspace .ticket-sidebar-freshdesk {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 8px 16px 16px;
  gap: 0;
  max-height: 100%;
  min-width: 0;
}
.ticket-view-workspace .ticket-sidebar-freshdesk.is-ai-chat {
  overflow: hidden;
}
.ticket-view-workspace .sidebar-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  margin-left: -2px;
  cursor: col-resize;
  z-index: 6;
  touch-action: none;
  background: transparent;
}
.ticket-view-workspace .sidebar-resize-handle::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 1px;
  background: transparent;
  transition: background-color 0.15s, box-shadow 0.15s;
}
.ticket-view-workspace .sidebar-resize-handle:hover::after,
.ticket-view-workspace .sidebar-resize-handle:focus-visible::after,
body.sidebar-resizing .ticket-view-workspace .sidebar-resize-handle::after {
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
body.sidebar-resizing {
  cursor: col-resize !important;
  -webkit-user-select: none !important;
     -moz-user-select: none !important;
          user-select: none !important;
}
body.sidebar-resizing iframe,
body.sidebar-resizing .CodeMirror {
  pointer-events: none !important;
}
.ticket-view-workspace .sidebar-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.ticket-view-workspace .sidebar-section:last-child {
  border-bottom: none;
}
/* Sidebar Details | AI assist tabs + chat */
.ticket-view-workspace .sidebar-tabs {
  display: flex;
  gap: 0;
  flex-shrink: 0;
  margin: 4px 0 8px;
  border-bottom: 1px solid var(--border);
}
.ticket-view-workspace .sidebar-tab {
  flex: 1;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  border: none;
  background: transparent;
  padding: 8px 10px;
  margin-bottom: -1px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.ticket-view-workspace .sidebar-tab:hover {
  color: var(--text-primary);
}
.ticket-view-workspace .sidebar-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.ticket-view-workspace .sidebar-details-pane {
  min-height: 0;
}
.ticket-view-workspace .ai-assist-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin: 0 -4px;
}
.ticket-view-workspace .ai-assist-pane[hidden],
.ticket-view-workspace .sidebar-details-pane[hidden] {
  display: none !important;
}
.ticket-view-workspace .ai-assist-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 4px 12px;
}
.ticket-view-workspace .ai-assist-empty {
  margin: auto 0;
  padding: 24px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ticket-view-workspace .ai-assist-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-light, #eef4ff);
  margin-bottom: 4px;
}
.ticket-view-workspace .ai-assist-empty-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.ticket-view-workspace .ai-assist-empty-copy {
  margin: 0 0 8px;
  max-width: 280px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.ticket-view-workspace .ai-chat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}
.ticket-view-workspace .ai-chat-row-user {
  align-items: stretch;
}
.ticket-view-workspace .ai-chat-row-assistant,
.ticket-view-workspace .ai-chat-row-system {
  align-items: flex-start;
}
.ticket-view-workspace .ai-chat-meta {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  padding: 0 2px;
}
.ticket-view-workspace .ai-chat-bubble {
  max-width: 100%;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.ticket-view-workspace .ai-chat-bubble-user {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  max-width: 95%;
}
.ticket-view-workspace .ai-chat-bubble-assistant {
  width: 100%;
  padding: 0;
  background: transparent;
  color: var(--text-primary);
}
.ticket-view-workspace .ai-chat-draft {
  margin: 0;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
}
.ticket-view-workspace .ai-chat-text {
  margin: 0;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  color: var(--text-primary);
}
.ticket-view-workspace .ai-chat-text > :first-child {
  margin-top: 0;
}
.ticket-view-workspace .ai-chat-text > :last-child {
  margin-bottom: 0;
}
.ticket-view-workspace .ai-chat-text p {
  margin: 0 0 0.75em;
}
.ticket-view-workspace .ai-chat-text ul,
.ticket-view-workspace .ai-chat-text ol {
  margin: 0 0 0.75em;
  padding-left: 1.35em;
}
.ticket-view-workspace .ai-chat-text li {
  margin: 0.25em 0;
}
.ticket-view-workspace .ai-chat-text strong {
  font-weight: 600;
}
.ticket-view-workspace .ai-chat-text code {
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--bg-secondary);
}
.ticket-view-workspace .ai-chat-text pre {
  margin: 0 0 0.75em;
  padding: 10px 12px;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}
.ticket-view-workspace .ai-chat-text pre code {
  padding: 0;
  background: transparent;
}
.ticket-view-workspace .ai-chat-text a {
  color: var(--link, #2563eb);
  text-decoration: underline;
}
.ticket-view-workspace .ai-chat-sources {
  margin-top: 8px;
  padding: 0 2px;
}
.ticket-view-workspace .ai-chat-sources[hidden] {
  display: none !important;
}
.ticket-view-workspace .ai-chat-sources-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.ticket-view-workspace .ai-chat-sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ticket-view-workspace .ai-chat-sources-list a {
  display: inline-block;
  max-width: 100%;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  word-break: break-word;
}
.ticket-view-workspace .ai-chat-sources-list a:hover {
  text-decoration: underline;
}
.ticket-view-workspace .ai-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 0;
}
.ticket-view-workspace .ai-chat-action {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-card, #fff);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.ticket-view-workspace .ai-chat-action:hover {
  background: var(--bg-secondary);
  border-color: var(--text-muted);
  color: var(--text-primary);
}
.ticket-view-workspace .ai-chat-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.ticket-view-workspace .ai-chat-action-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: none;
}
.ticket-view-workspace .ai-chat-action-primary:hover {
  background: var(--accent-hover, #1d4ed8);
  border-color: var(--accent-hover, #1d4ed8);
  color: #fff;
}
.ticket-view-workspace .ai-chat-bubble-system {
  padding: 8px 12px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
}
.ticket-view-workspace .ai-chat-bubble-thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 12px;
}
.ticket-view-workspace .ai-assist-thinking-dots {
  display: inline-flex;
  gap: 3px;
}
.ticket-view-workspace .ai-assist-thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: ai-assist-dot 1.2s ease-in-out infinite;
}
.ticket-view-workspace .ai-assist-thinking-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.ticket-view-workspace .ai-assist-thinking-dots span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes ai-assist-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
.ticket-view-workspace .ai-assist-summarize {
  align-self: flex-start;
  margin: 0 12px 8px;
}
.ticket-view-workspace .ai-assist-composer {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding: 10px 10px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.ticket-view-workspace .ai-assist-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  padding: 2px 0;
  min-height: 22px;
  max-height: 140px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
  font-family: inherit;
}
.ticket-view-workspace .ai-assist-input::-moz-placeholder {
  color: var(--text-muted);
}
.ticket-view-workspace .ai-assist-input::placeholder {
  color: var(--text-muted);
}
.ticket-view-workspace .ai-assist-send {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ticket-view-workspace .ai-assist-send:hover {
  background: var(--accent-hover, #1d4ed8);
}
.ticket-view-workspace .ai-assist-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ticket-view-workspace .ai-assist-status {
  flex-shrink: 0;
  margin: 4px 4px 0;
  min-height: 1.1em;
  font-size: 11px;
  color: var(--text-muted);
}
.ticket-view-workspace .sidebar-title {
  font-size: 11px;
  margin: 0 0 8px 0;
  padding-bottom: 0;
  border-bottom: none;
  color: var(--text-muted);
}
.ticket-view-workspace .sidebar-content {
  gap: 6px;
}
.ticket-view-workspace .sidebar-field {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 28px;
}
.ticket-view-workspace .sidebar-field .sidebar-label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 500;
}
.ticket-view-workspace .sidebar-field .sidebar-value {
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
}
.ticket-view-workspace .sidebar-value-muted {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}
.ticket-view-workspace .sidebar-field .inline-form {
  gap: 0;
}
.ticket-view-workspace .sidebar-field .form-control-sm {
  padding: 4px 8px;
  font-size: 12px;
}
.ticket-view-workspace .sidebar-contact-card .contact-card-header {
  gap: 10px;
  margin-bottom: 0;
}
.ticket-view-workspace .contact-card-avatar {
  width: 36px;
  height: 36px;
  font-size: 14px;
}
.ticket-view-workspace .contact-card-name {
  font-size: 14px;
}
.ticket-view-workspace .contact-extra-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ticket-view-workspace .contact-extra-details > .sidebar-title {
  margin-bottom: 0;
}
.ticket-view-workspace .sidebar-disclosure > .sidebar-title {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ticket-view-workspace .sidebar-disclosure > .sidebar-title::-webkit-details-marker {
  display: none;
}
.ticket-view-workspace .sidebar-disclosure > .sidebar-title::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  margin-left: 8px;
}
.ticket-view-workspace .sidebar-disclosure[open] > .sidebar-title::after {
  transform: rotate(45deg);
}
/* Assignee + optional reassign note must stack — .inline-form is row flex by
   default, which put the select beside the note and stretched it tall. */
.ticket-view-workspace .sidebar-field-assignee {
  align-items: start;
}
.assignee-form.inline-form {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.assignee-form.inline-form > .form-control {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  align-self: stretch;
}
.assignee-reassign-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 0;
  min-width: 0;
}
/* Class display:flex otherwise beats the UA [hidden] { display: none }. */
.assignee-reassign-note[hidden] {
  display: none;
}
.assignee-reassign-note-label {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}
.assignee-reassign-note textarea.form-control {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
}
.assignee-reassign-submit {
  align-self: flex-start;
}
.ticket-view-workspace .sidebar-disclosure .sidebar-content {
  margin-top: 8px;
}
.ticket-view-workspace .sidebar-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.ticket-view-workspace .sidebar-section-heading .sidebar-title {
  margin: 0;
}
.ticket-view-workspace .sidebar-activity-section .sidebar-content {
  margin-bottom: 8px;
}
.ticket-view-workspace .sidebar-print-link {
  font-size: 13px;
}
.ticket-view-workspace .sidebar-timeline-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}
.ticket-view-workspace .sidebar-timeline-trigger:hover {
  text-decoration: underline;
}
.ticket-timeline-modal .modal-content {
  max-width: 480px;
}
.ticket-timeline-modal .modal-body {
  padding: 16px 24px 24px;
}
.ticket-timeline-lead {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-secondary);
}
.ticket-timeline-modal .sidebar-timeline {
  padding-left: 22px;
}
.ticket-timeline-modal .sidebar-timeline-item {
  padding-bottom: 16px;
}
.ticket-timeline-modal .sidebar-timeline-body {
  font-weight: 400;
  white-space: normal;
}
.ticket-timeline-modal .sidebar-timeline-body p {
  margin: 0 0 6px;
}
.ticket-timeline-modal .sidebar-timeline-body p:last-child {
  margin-bottom: 0;
}
.ticket-timeline-modal .sidebar-timeline-dot-event {
  background: var(--text-muted);
}
.ticket-timeline-modal .sidebar-timeline-dot-agent {
  background: var(--accent);
}
.ticket-timeline-modal .sidebar-timeline-dot-customer {
  background: var(--text-secondary);
}
.ticket-timeline-modal .sidebar-timeline-dot-viewed {
  background: #81C784;
}
.ticket-timeline-modal .sidebar-timeline-dot-unread {
  background: #EF5350;
}
.ticket-view-workspace .scroll-to-bottom-fab {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 5;
}
/* Mobile-only chrome — shown inside max-width:768px */
.ticket-reply-sheet-header,
.ticket-details-drawer-header,
.ticket-reply-fab,
.ticket-reply-backdrop,
.ticket-details-backdrop {
  display: none;
}
.sidebar-actions-inline {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.sidebar-actions-inline form {
  width: 100%;
}
.sidebar-actions-inline .button_to {
  width: 100%;
}
.sidebar-actions-inline .button_to .btn,
.sidebar-actions-inline .button_to button {
  width: 100%;
}
.reply-status-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.reply-status-select {
  width: auto;
  min-width: 170px;
}
.collapse-thread-btn {
  display: block;
  width: 100%;
  margin-bottom: 16px;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.collapse-thread-btn:hover {
  background: var(--accent-light);
}
/* Responsive */
@media (max-width: 1024px) {
  .ticket-view-content {
    grid-template-columns: 1fr;
  }

  .ticket-sidebar-freshdesk {
    order: -1;
  }

  .ticket-view-workspace .sidebar-resize-handle {
    display: none;
  }

  .ticket-view-workspace .ticket-view-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
  }

  .ticket-view-workspace .ticket-view-header-right {
    max-width: 100%;
  }

  .ticket-view-workspace .ticket-sidebar-freshdesk {
    order: 0;
    max-height: 36vh;
    border-top: 1px solid var(--border);
  }

  .ticket-view-workspace .ticket-conversation {
    border-right: none;
    min-width: 0;
  }

  .ticket-view-workspace .conversation-reply {
    min-width: 0;
    max-width: 100%;
  }

  .conversation-item-internal {
    margin-left: 0;
  }

}
/* Ticket Detail - Legacy (keeping for backward compatibility) */
.ticket-detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}
.ticket-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.ticket-header h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.ticket-actions {
  display: flex;
  gap: 8px;
}
.ticket-main {
  min-width: 0;
}
.ticket-sidebar {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  height: -moz-fit-content;
  height: fit-content;
  position: sticky;
  top: 100px;
}
.ticket-sidebar h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ticket-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ticket-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.ticket-info-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.ticket-info-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.ticket-info-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}
.ticket-info-value .ticket-link {
  color: var(--accent);
  text-decoration: none;
}
.ticket-info-value .ticket-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.ticket-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}
.ticket-content h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.content-box {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}
/* Replies Section - Freshdesk Style */
.replies-section {
  margin-bottom: 24px;
}
.replies-section h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.reply-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.2s;
}
.reply-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--shadow);
}
.reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.reply-header strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.reply-date {
  font-size: 12px;
  color: var(--text-secondary);
}
.reply-content {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.reply-form {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}
.reply-form h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.notes-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}
.notes-section h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.internal-comments-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}
.internal-comments-section h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.comment-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
}
.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.comment-header strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.comment-date {
  font-size: 12px;
  color: var(--text-secondary);
}
.comment-content {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.ticket-actions-footer {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btn-danger {
  background-color: rgba(244, 67, 54, 0.12);
  border-color: rgba(244, 67, 54, 0.45);
  color: #C62828;
}
.btn-danger:hover {
  background-color: rgba(244, 67, 54, 0.2);
  border-color: rgba(244, 67, 54, 0.6);
  color: #B71C1C;
}
.btn-close-ticket {
  background-color: rgba(255, 152, 0, 0.12);
  border-color: rgba(255, 152, 0, 0.45);
  color: #EF6C00;
}
.btn-close-ticket:hover {
  background-color: rgba(255, 152, 0, 0.2);
  border-color: rgba(255, 152, 0, 0.6);
  color: #E65100;
}
.btn-escalate {
  background-color: rgba(2, 136, 209, 0.12);
  border-color: rgba(2, 136, 209, 0.45);
  color: #0277BD;
}
.btn-escalate:hover {
  background-color: rgba(2, 136, 209, 0.2);
  border-color: rgba(2, 136, 209, 0.6);
  color: #01579B;
}
.sidebar-escalate-section .sidebar-escalate-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.sidebar-escalate-section .sidebar-escalate-btn {
  width: 100%;
  justify-content: center;
}
.sidebar-escalate-section .sidebar-escalate-unlink {
  margin-top: 8px;
}
.sidebar-escalate-section .sidebar-escalate-warning {
  color: #b45309;
}
.redmine-report-modal .modal-content {
  max-width: 720px;
}
.redmine-report-lead {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.redmine-report-form .form-group {
  margin-bottom: 14px;
}
.redmine-report-form .form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.redmine-report-description {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
  min-height: 280px;
  resize: vertical;
}
/* Danger zone (e.g. permanent delete on edit pages) */
.danger-zone-card {
  margin-top: 32px;
  padding: 20px 24px;
  border: 1px solid rgba(244, 67, 54, 0.35);
  border-radius: 8px;
  background-color: rgba(244, 67, 54, 0.06);
}
.danger-zone-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #EF5350;
}
.danger-zone-description {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.btn-success {
  background-color: rgba(76, 175, 80, 0.2);
  border-color: rgba(76, 175, 80, 0.4);
  color: #81C784;
}
.btn-success:hover {
  background-color: rgba(76, 175, 80, 0.3);
  border-color: rgba(76, 175, 80, 0.5);
}
/* Responsive */
@media (max-width: 1024px) {
  .ticket-detail {
    grid-template-columns: 1fr;
  }
  
  .ticket-sidebar {
    position: static;
  }
}
/* Badges - Freshdesk Style (Dark Theme) */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
/* Shown in ticket list Status column when an agent is in the reply field (unassigned tickets) */
.typing-indicator {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  font-style: italic;
}
/* Ticket list: overlay over subject (95% opaque) so subject stays visible underneath */
td[data-typing-subject-cell] {
  position: relative;
}
.typing-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: color-mix(in srgb, var(--bg-primary) 95%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.typing-overlay .typing-indicator--overlay,
.typing-overlay .typing-indicator {
  font-size: 14px;
  font-weight: 500;
  font-style: normal;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Banner on ticket show page when another agent is typing a reply */
.typing-indicator-banner {
  padding: 10px 16px;
  margin-bottom: 16px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}
.typing-indicator-banner [data-typing-indicator-target="message"] {
  font-weight: 700;
  color: var(--accent);
}
.badge-status-open {
  background-color: #C8E6C9;
  color: #1B5E20;
  border: 1px solid #81C784;
}
.badge-status-awaiting_member {
  background-color: #FFE0B2;
  color: #E65100;
  border: 1px solid #FFB74D;
}
.badge-status-member_viewed {
  background-color: #FFE0B2;
  color: #E65100;
  border: 1px solid #FFB74D;
}
.badge-status-viewed {
  background-color: #E3F2FD;
  color: #1565C0;
  border: 1px solid #90CAF9;
  margin-left: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.badge-status-suffix {
  font-weight: 500;
  opacity: 0.85;
}
.badge-status-closed {
  background-color: #E0E0E0;
  color: #212121;
  border: 1px solid #9E9E9E;
}
.badge-priority-high {
  background-color: #FFCDD2;
  color: #B71C1C;
  border: 1px solid #E57373;
}
.badge-priority-normal {
  background-color: #EEEEEE;
  color: #424242;
  border: 1px solid #BDBDBD;
}
/* Role Badges */
.badge-role-client {
  background-color: #E0E0E0;
  color: #424242;
  border: 1px solid #9E9E9E;
}
.badge-role-staff {
  background-color: #BBDEFB;
  color: #0D47A1;
  border: 1px solid #64B5F6;
}
.badge-role-admin {
  background-color: #FFE0B2;
  color: #E65100;
  border: 1px solid #FFB74D;
}
.badge-role-super_admin {
  background-color: #E1BEE7;
  color: #4A148C;
  border: 1px solid #CE93D8;
}
/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover {
  background-color: var(--hover-bg);
  border-color: var(--border);
}
.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* a:hover sets color to --accent-hover; without this, primary button text
   matches the hover background and disappears. */
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:focus-visible,
a.btn-primary:hover,
a.btn-primary:focus,
a.btn-primary:focus-visible {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
/* Follow-up: must follow .btn / .btn:hover or those rules override color + background.
   Inactive = green outline; active = solid green so Unfollow stays obvious on hover. */
.btn.btn-followup {
  background-color: rgba(46, 125, 50, 0.08);
  border-color: rgba(46, 125, 50, 0.5);
  color: #2E7D32;
}
.btn.btn-followup:hover,
.btn.btn-followup:focus,
.btn.btn-followup:focus-visible {
  background-color: rgba(46, 125, 50, 0.16);
  border-color: rgba(46, 125, 50, 0.7);
  color: #1B5E20;
}
.btn.btn-followup-active {
  background-color: #2E7D32;
  border-color: #2E7D32;
  color: #fff;
  font-weight: 600;
}
.btn.btn-followup-active:hover,
.btn.btn-followup-active:focus,
.btn.btn-followup-active:focus-visible {
  background-color: #1B5E20;
  border-color: #1B5E20;
  color: #fff;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}
/* Forms */
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(3, 113, 183, 0.2);
}
.form-control::-moz-placeholder {
  color: var(--text-muted);
}
.form-control::placeholder {
  color: var(--text-muted);
}
/* Filters */
.filter-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.filter-row .form-group {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}
/* Shared list/workspace page chrome */
.workspace-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.workspace-page-header-copy h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.workspace-page-header-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.workspace-page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
/* Legacy altpost-style Domain Expired / RAA Unverified shortcuts */
.ticket-quick-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}
.ticket-quick-presets-medusa {
  width: 120px;
  min-width: 100px;
  padding: 6px 10px;
  font-size: 13px;
}
.ticket-quick-presets .btn {
  white-space: nowrap;
}
.workspace-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px 0;
}
.workspace-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.workspace-chip:hover {
  background: var(--hover-bg);
  color: var(--accent);
  border-color: var(--accent);
}
.workspace-chip.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.workspace-chip-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.workspace-chip.active .workspace-chip-count {
  color: inherit;
  opacity: 0.8;
}
/* Tickets page: viewport workspace + persistent right filters rail */
.tickets-page-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 0;
  overflow: hidden;
}
.tickets-main {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 28px 12px;
}
.tickets-main .text-secondary {
  color: var(--text-primary);
  font-weight: 500;
}
.tickets-list-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tickets-list-pane .tickets-table-card {
  /* Size to rows; only fill/scroll when the list exceeds the pane. */
  flex: 0 1 auto;
  max-height: 100%;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tickets-table-head {
  flex-shrink: 0;
  background-color: var(--bg-nav);
}
.tickets-table-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tickets-table-body::-webkit-scrollbar {
  display: none;
}
.tickets-list-pane .tickets-table {
  table-layout: fixed;
}
.tickets-list-pane .tickets-col-select {
  width: 36px;
}
.tickets-list-pane .tickets-col-status {
  width: 168px;
}
.tickets-list-pane .tickets-table tbody tr {
  height: 56px;
}
.tickets-list-pane .tickets-table td {
  height: 56px;
  box-sizing: border-box;
}
.tickets-list-pane .ticket-status-cell .badge {
  white-space: nowrap;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.tickets-list-pane .ticket-status-cell .badge-status-suffix {
  font-weight: 500;
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
}
.tickets-list-pane .tickets-col-assigned {
  width: 120px;
}
.tickets-list-pane .tickets-col-updated {
  width: 130px;
}
.tickets-main > .pagination-wrapper {
  flex-shrink: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.tickets-filters-rail {
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  padding: 20px 16px 24px;
  background: var(--bg-primary);
}
.tickets-filters-rail .sidebar-title {
  font-size: 11px;
  margin: 0 0 12px 0;
  padding-bottom: 0;
  border-bottom: none;
  color: var(--text-muted);
}
.tickets-filters-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tickets-followups-pref {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
}
.tickets-followups-pref-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  cursor: pointer;
}
.tickets-followups-pref-checkbox {
  margin: 2px 0 0;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.tickets-followups-pref-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tickets-followups-pref-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.tickets-followups-pref-hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.35;
}
.tickets-filters-rail .sidebar-field {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 28px;
}
.tickets-filters-rail .sidebar-field .sidebar-label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 500;
}
.tickets-filters-rail .sidebar-field .sidebar-value {
  min-width: 0;
  display: block;
}
.tickets-filters-rail .form-control,
.tickets-filters-rail .form-control-sm {
  width: 100%;
  padding: 4px 8px;
  font-size: 12px;
}
/* Custom filter selects: desktop UI; native <select> remains for mobile + form submit */
.filter-select {
  position: relative;
  width: 100%;
}
.filter-select-trigger {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-sizing: border-box;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.filter-select-trigger:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--hover-bg);
}
.filter-select.is-open .filter-select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}
.filter-select-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter-select-chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.15s ease;
}
.filter-select.is-open .filter-select-chevron {
  transform: rotate(180deg);
}
.filter-select-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: min(280px, 50vh);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-primary);
  box-shadow: 0 8px 24px var(--shadow);
}
.filter-select-menu[hidden] {
  display: none !important;
}
.filter-select-option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.filter-select-option:hover {
  background: var(--hover-bg);
}
.filter-select-option.is-selected {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.filter-select-native {
  width: 100%;
}
@media (min-width: 1025px) {
  .filter-select-trigger {
    display: inline-flex;
  }

  .filter-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
.tickets-filters-actions {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
@media (max-width: 1024px) {
  .tickets-page-layout {
    grid-template-columns: 1fr;
  }

  .tickets-main {
    padding: 16px 20px 12px;
  }
}
/* Filters drawer + denser ticket list (tablet/phone) */
.tickets-filters-open-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.tickets-filters-mobile-toggle,
.tickets-filters-close,
.tickets-filters-backdrop {
  display: none;
}
.tickets-filters-rail-header {
  display: none;
}
@media (max-width: 1024px) {
  .tickets-filters-mobile-toggle {
    display: inline-flex;
  }

  .tickets-filters-rail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
  }

  .tickets-filters-rail-header .sidebar-title {
    margin: 0;
  }

  .tickets-filters-close {
    display: inline-flex;
  }

  .tickets-filters-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 190;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .tickets-filters-rail {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(100vw - 48px, 320px);
    max-height: none;
    order: 0;
    z-index: 200;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    border-bottom: none;
    padding: 16px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  }

  .tickets-filters-open-input:checked ~ .tickets-filters-rail {
    transform: translateX(0);
  }

  .tickets-filters-open-input:checked ~ .tickets-filters-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}
/* —— Mobile app shell (dedicated mobile UI, not shrunk desktop) —— */
.mobile-nav-toggle,
.tickets-mobile-list,
.ticket-actions-mobile,
.ticket-mobile-back,
.user-tickets-mobile-list,
.admin-mobile-list,
.user-tickets-filters-toggle {
  display: none;
}
.mobile-nav-drawer,
.mobile-nav-backdrop {
  display: none;
}
.tickets-mobile-section-label {
  margin: 0;
  padding: 10px 4px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ticket-mobile-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}
.ticket-mobile-card-high {
  background: color-mix(in srgb, #c62828 6%, var(--bg-card));
}
.ticket-mobile-card-unread .ticket-mobile-subject {
  font-weight: 700;
}
.ticket-mobile-card-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ticket-mobile-avatar {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}
.ticket-mobile-card-main {
  min-width: 0;
  flex: 1;
}
.ticket-mobile-subject {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.ticket-mobile-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.ticket-mobile-card-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.ticket-mobile-assigned {
  font-size: 12px;
  color: var(--text-secondary);
}
.ticket-mobile-assigned.is-empty {
  color: var(--text-muted);
  font-style: italic;
}
.ticket-mobile-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.admin-mobile-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}
.admin-mobile-card-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.admin-mobile-card-main {
  min-width: 0;
  flex: 1;
}
.admin-mobile-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.admin-mobile-card-title a {
  color: inherit;
  text-decoration: none;
}
.admin-mobile-card-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.admin-mobile-card-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.admin-mobile-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.admin-mobile-card-actions .btn {
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}
.admin-mobile-select {
  flex: 0 0 auto;
  margin-top: 2px;
}
.ticket-actions-sheet {
  position: relative;
}
.ticket-actions-sheet > summary {
  list-style: none;
  cursor: pointer;
}
.ticket-actions-sheet > summary::-webkit-details-marker {
  display: none;
}
.ticket-actions-sheet-body {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 200px;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ticket-actions-sheet-btn,
.ticket-actions-sheet-body .button_to,
.ticket-actions-sheet-body .header-action-form {
  width: 100%;
  margin: 0;
}
.ticket-actions-sheet-btn,
.ticket-actions-sheet-body .btn {
  width: 100%;
  justify-content: center;
}
@media (max-width: 768px) {
  body.mobile-nav-open {
    overflow: hidden;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .header-nav,
  .header-admin-desktop,
  .search-shortcut {
    display: none;
  }

  /* Single-row app chrome: menu + logo + search + utilities */
  .app-header {
    height: 48px;
    min-height: 48px;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0 4px 0 0;
  }

  .header-left {
    padding-left: 4px;
    gap: 2px;
    min-width: 0;
    flex: 0 0 auto;
    height: 100%;
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 4px;
    padding-right: 8px;
    overflow: hidden;
  }

  .header-right > .header-user {
    margin-right: 0;
    flex: 0 0 auto;
  }

  .header-right > .header-notifications,
  .header-right > .header-icon {
    flex: 0 0 auto;
  }

  .header-search {
    order: 0;
    flex: 1 1 0;
    width: auto;
    max-width: none;
    min-width: 0;
    margin: 0;
    height: 34px;
    padding: 4px 8px;
  }

  .header-search input {
    font-size: 14px;
    min-width: 0;
    width: 100%;
  }

  .user-avatar {
    width: 28px;
    height: 28px;
  }

  .header-logo-img {
    height: 22px;
  }

  .page-container {
    padding: 12px 14px 20px;
  }

  .page-container > .alert,
  .tickets-main > .alert {
    margin: 0 0 10px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.35;
  }

  .workspace-page-header {
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
  }

  .workspace-page-header-copy h1,
  .page-header h1 {
    font-size: 18px;
  }

  .workspace-page-header-meta,
  .page-header p {
    display: none;
  }

  .workspace-page-actions {
    gap: 6px;
  }

  .filters-card {
    margin-bottom: 10px;
  }

  .filters-card .filter-row {
    flex-direction: column;
    gap: 8px;
  }

  .filters-card .filter-row .form-group {
    min-width: 0;
    width: 100%;
  }

  /* Admin / profile: compact chrome, card lists instead of wide tables */
  .admin-page .admin-form-card,
  .profile-form-card {
    overflow-x: visible;
  }

  .admin-page .workspace-page-header {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
  }

  .admin-page .workspace-page-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .admin-page .workspace-page-actions .btn,
  .admin-page .workspace-page-actions .form-control {
    min-height: 34px;
  }

  .admin-page .workspace-page-actions form {
    display: none;
  }

  .admin-desktop-table {
    display: none !important;
  }

  .admin-mobile-list {
    display: block;
  }

  .admin-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .admin-card {
    padding: 14px;
  }

  .admin-card-desc {
    display: none;
  }

  .admin-status-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px !important;
  }

  .admin-form-card,
  .profile-form-card {
    padding: 14px;
    border-radius: 10px;
  }

  .profile-page .workspace-page-header {
    margin-bottom: 10px;
  }

  .profile-layout-grid {
    gap: 12px;
  }

  .profile-page .profile-sidebar {
    order: -1;
  }

  .profile-avatar-card {
    padding: 14px;
  }

  .profile-avatar-card .profile-avatar-upload-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    width: 100%;
  }

  .profile-avatar-card-label {
    display: none;
  }

  .profile-page .profile-avatar-preview {
    padding: 8px;
    margin: 0;
    flex: 0 0 auto;
  }

  .profile-page .profile-avatar-img,
  .profile-page .profile-avatar-initials {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }

  .profile-avatar-upload-text {
    font-size: 13px;
    font-weight: 600;
    margin-top: 0;
  }

  .profile-avatar-hint {
    display: none;
  }

  .profile-page .profile-section-title {
    margin-bottom: 12px;
    font-size: 13px;
  }

  .profile-page .form-group {
    margin-bottom: 12px;
  }

  .profile-page .form-control {
    max-width: none !important;
  }

  .profile-page .form-actions {
    position: sticky;
    bottom: 0;
    margin: 16px -14px -14px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    z-index: 5;
  }

  .profile-page .form-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .user-tickets-filters-toggle {
    display: inline-flex;
  }

  body.user-tickets-index .filters-card {
    display: none;
    margin-bottom: 10px;
  }

  body.user-tickets-index #user-tickets-filters-open:checked ~ .filters-card {
    display: block;
  }

  body.user-tickets-index .page-container {
    padding: 10px 12px 16px;
  }

  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 220;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .app-shell.is-open .mobile-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-nav-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 320px);
    z-index: 230;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  }

  .app-shell.is-open .mobile-nav-drawer {
    transform: translateX(0);
  }

  .mobile-nav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
  }

  .mobile-nav-drawer-title {
    font-size: 15px;
    font-weight: 600;
  }

  .mobile-nav-drawer-body {
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .mobile-nav-link {
    display: block;
    padding: 12px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
  }

  .mobile-nav-link:hover,
  .mobile-nav-link.active {
    background: var(--hover-bg);
    color: var(--accent);
  }

  .workspace-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 10px;
    padding-bottom: 2px;
    max-width: 100%;
  }

  .workspace-chips::-webkit-scrollbar {
    display: none;
  }

  .workspace-chip {
    flex: 0 0 auto;
  }

  body.tickets-inbox {
    height: 100svh;
    height: 100dvh;
  }

  .tickets-main {
    padding: 8px 10px calc(56px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    /* One scroll for header + cards + pagination — nested list scroll made the
       last rows unreachable under mobile browser chrome (esp. Firefox Android). */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }


  body.tickets-inbox .workspace-page-header {
    margin-bottom: 8px;
  }

  body.tickets-inbox .workspace-page-header-copy h1 {
    font-size: 17px;
  }

  .tickets-filters-mobile-toggle {
    min-height: 32px;
  }

  .tickets-list-pane .tickets-table-card.tickets-desktop-table,
  .tickets-desktop-table {
    display: none;
  }

  .tickets-mobile-list,
  .user-tickets-mobile-list {
    display: block;
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
    padding-bottom: 16px;
  }

  .tickets-mobile-list .ticket-mobile-card:last-child {
    margin-bottom: 0;
  }


  .user-tickets-desktop-table {
    display: none;
  }

  .tickets-list-pane {
    flex: 0 0 auto;
    overflow: visible;
  }

  .tickets-main > .pagination-wrapper {
    margin-top: 8px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }


  .bulk-actions-bar {
    flex-wrap: wrap;
  }

  .app-footer {
    display: none;
  }

  /* —— Ticket show: Freshdesk/Zendesk-style compact chrome ——
     Thread owns the viewport. Search + notices stay on the inbox. */
  body.ticket-workspace .app-header-wrapper {
    display: none;
  }

  body.ticket-workspace .page-container > .alert {
    display: none;
  }

  body.ticket-workspace {
    height: 100svh;
    height: 100dvh;
    overflow: hidden;
  }


  body.ticket-workspace.ticket-details-open,
  body.ticket-workspace.ticket-reply-open {
    overflow: hidden;
  }

  body.ticket-workspace .app-shell,
  body.ticket-workspace .app-main,
  body.ticket-workspace .page-container {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    flex: 1 1 auto;
  }

  body.ticket-workspace .ticket-view-layout,
  body.ticket-workspace .ticket-view-workspace,
  body.ticket-workspace .ticket-view-freshdesk {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* One compact toolbar: [←] #id OPEN HIGH  [details] [⋯] */
  .ticket-view-workspace .ticket-view-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    padding: 2px 4px;
    gap: 2px;
    flex-shrink: 0;
    min-height: 44px;
    border-bottom: 1px solid var(--border);
  }

  .ticket-mobile-back {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .ticket-view-workspace .ticket-view-header-left {
    min-width: 0;
    flex: 1 1 auto;
    width: auto;
  }

  .ticket-view-workspace .ticket-title-section {
    min-width: 0;
  }

  .ticket-view-workspace .ticket-title-row {
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
  }

  .ticket-view-workspace .ticket-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ticket-view-workspace .ticket-badges {
    flex-wrap: nowrap;
    gap: 4px;
    min-width: 0;
  }

  .ticket-view-workspace .ticket-badges .badge {
    font-size: 10px;
    padding: 2px 6px;
    line-height: 1.2;
  }

  .ticket-view-workspace .ticket-reply-count-badge,
  .ticket-view-workspace .ticket-view-subject {
    display: none;
  }

  .ticket-actions-desktop {
    display: none;
  }

  .ticket-actions-mobile {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    width: auto;
    flex: 0 0 auto;
  }

  .ticket-actions-mobile .ticket-actions-sheet > summary {
    list-style: none;
  }

  .ticket-actions-mobile .ticket-actions-sheet > summary::-webkit-details-marker {
    display: none;
  }

  .ticket-view-workspace .typing-indicator-banner {
    margin: 4px 8px 0;
    font-size: 12px;
    padding: 6px 8px;
  }

  .ticket-view-workspace .ticket-view-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
    flex: 1 1 0%;
    height: auto;
  }

  .ticket-view-workspace .ticket-conversation {
    flex: 1 1 0%;
    min-height: 0;
    min-width: 0;
    border-right: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .ticket-view-workspace .ticket-conversation-pane {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    position: relative;
  }

  .ticket-view-workspace .ticket-conversation-messages {
    height: 100%;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 12px 88px;
  }

  .ticket-view-workspace .reply-resize-handle {
    display: none;
  }

  /* Reply lives in a bottom sheet — not in the scroll flow */
  .ticket-view-workspace .conversation-reply:not(.ticket-deleted-banner) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 250;
    display: flex;
    flex-direction: column;
    flex: none;
    gap: 0;
    margin: 0;
    padding: 0;
    max-width: none;
    min-width: 0;
    height: min(78dvh, 560px);
    max-height: min(78dvh, 560px);
    overflow: hidden;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    background: var(--bg-card);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.18);
    transform: translateY(110%);
    transition: transform 0.22s ease;
  }


  body.ticket-reply-open .ticket-view-workspace .conversation-reply:not(.ticket-deleted-banner) {
    transform: translateY(0);
  }

  .ticket-view-workspace .conversation-reply.ticket-deleted-banner {
    position: relative;
    flex: 0 0 auto;
    padding: 12px;
  }

  .ticket-reply-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    padding: 16px 14px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
  }

  .ticket-reply-sheet-header::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 999px;
    background: var(--border);
  }

  .ticket-reply-sheet-title {
    font-size: 15px;
    font-weight: 600;
  }

  .ticket-reply-backdrop,
  .ticket-details-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 240;
    background: rgba(0, 0, 0, 0.4);
  }

  .ticket-reply-backdrop[hidden],
  .ticket-details-backdrop[hidden] {
    display: none;
  }

  .ticket-view-workspace .conversation-reply .conversation-avatar {
    display: none;
  }

  .ticket-view-workspace .conversation-reply-form {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .ticket-view-workspace .conversation-reply-form > form {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .ticket-view-workspace .conversation-reply-form .form-group {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 8px 12px 0;
    overflow: hidden;
  }

  .ticket-view-workspace .conversation-reply .reply-attach-hint {
    display: none;
  }

  .ticket-view-workspace .conversation-reply .EasyMDEContainer {
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .ticket-view-workspace .conversation-reply .EasyMDEContainer .CodeMirror {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: none;
    /* Don't use height:auto !important — it fights ticket-mobile#setSize and
       collapses the editor on Firefox Android when nested flex heights are 0. */
    border-radius: 8px;
  }

  .ticket-view-workspace .conversation-reply .editor-toolbar {
    flex-wrap: nowrap;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px 8px 0 0;
  }


  .ticket-view-workspace .conversation-reply .editor-toolbar .strikethrough,
  .ticket-view-workspace .conversation-reply .editor-toolbar .heading-1,
  .ticket-view-workspace .conversation-reply .editor-toolbar .heading-2,
  .ticket-view-workspace .conversation-reply .editor-toolbar .heading-3,
  .ticket-view-workspace .conversation-reply .editor-toolbar .quote,
  .ticket-view-workspace .conversation-reply .editor-toolbar .unordered-list,
  .ticket-view-workspace .conversation-reply .editor-toolbar .ordered-list,
  .ticket-view-workspace .conversation-reply .editor-toolbar .table,
  .ticket-view-workspace .conversation-reply .editor-toolbar .guide,
  .ticket-view-workspace .conversation-reply .editor-toolbar .separator {
    display: none;
  }

  .ticket-view-workspace .conversation-reply .reply-form-actions {
    flex-shrink: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin: 0;
    padding: 10px 12px calc(20px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: var(--bg-card);
  }


  .ticket-view-workspace .conversation-reply .reply-form-options,
  .ticket-view-workspace .conversation-reply .reply-form-buttons {
    width: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .ticket-view-workspace .conversation-reply .reply-form-options {
    justify-content: flex-start;
    flex-wrap: wrap;
  }


  .ticket-view-workspace .conversation-reply .reply-form-buttons {
    justify-content: stretch;
  }

  .ticket-view-workspace .conversation-reply .reply-status-label {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: space-between;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
  }

  .ticket-view-workspace .conversation-reply .reply-status-select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    border: none;
    background: transparent;
    font-weight: 600;
  }

  .ticket-view-workspace .conversation-reply .reply-form-buttons .btn-primary {
    flex: 1 1 auto;
    min-height: 42px;
    justify-content: center;
  }

  .ticket-view-workspace .conversation-reply .reply-canned-picker,
  .ticket-view-workspace .conversation-reply .reply-form-options > .btn {
    flex: 1 1 0;
  }

  .ticket-view-workspace .conversation-reply .reply-canned-trigger,
  .ticket-view-workspace .conversation-reply .reply-form-options > .btn {
    width: 100%;
    justify-content: center;
  }

  /* Own row under canned/AI so it can't be squeezed off-screen on narrow sheets. */
  .ticket-view-workspace .conversation-reply .reply-frame-pickers {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .ticket-view-workspace .conversation-reply .reply-signature-picker {
    display: flex;
    width: 100%;
    gap: 8px;
  }

  .ticket-view-workspace .conversation-reply .reply-signature-label {
    flex: 1 1 auto;
    min-width: 0;
  }

  .ticket-view-workspace .conversation-reply .reply-signature-select {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
  }


  /* Details = right drawer (swipe from right edge) */
  .ticket-view-workspace .ticket-sidebar-freshdesk {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(92vw, 360px);
    z-index: 250;
    flex: none;
    max-height: none;
    order: 0;
    margin: 0;
    padding: 0 14px 24px;
    border: none;
    border-left: 1px solid var(--border);
    background: var(--bg-card);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(105%);
    transition: transform 0.22s ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  }

  body.ticket-details-open .ticket-view-workspace .ticket-sidebar-freshdesk {
    transform: translateX(0);
  }

  .ticket-details-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 0 10px;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
  }

  .ticket-details-drawer-title {
    font-size: 15px;
    font-weight: 600;
  }

  .ticket-reply-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
    height: 48px;
    padding: 0 18px 0 14px;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    cursor: pointer;
  }

  .ticket-reply-fab:active {
    transform: scale(0.97);
  }

  body.ticket-reply-open .ticket-reply-fab {
    display: none;
  }

  .scroll-to-bottom-fab {
    position: fixed;
    left: 16px;
    right: auto;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
    z-index: 60;
  }

  body.ticket-reply-open .scroll-to-bottom-fab {
    display: none;
  }

  .page-container {
    padding-left: 0;
    padding-right: 0;
  }

  body.tickets-inbox .page-container,
  body.ticket-workspace .page-container {
    max-width: none;
  }
}
/* Internal Comments: half-page slide-in panel (same pattern as Filters) */
.internal-comments-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.ticket-view-layout.internal-comments-panel-open .internal-comments-panel-overlay {
  opacity: 1;
  visibility: visible;
}
.internal-comments-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 50%;
  min-width: 380px;
  max-width: 560px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.ticket-view-layout.internal-comments-panel-open .internal-comments-panel {
  transform: translateX(0);
}
.internal-comments-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.internal-comments-panel-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}
.internal-comments-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
}
.internal-comments-panel-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.internal-comments-panel-body {
  flex: 1;
  overflow: hidden;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.internal-comments-panel-body .internal-comments-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-bottom: 12px; /* prevent last item's bottom border from being clipped when scrolling */
}
.internal-comments-panel-body .internal-comments-form {
  flex-shrink: 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
/* Compact styling inside internal comments panel – less “zoomed”, denser */
.internal-comments-panel .internal-comments-panel-body {
  padding: 14px 16px;
}
.internal-comments-panel .internal-comments-panel-header {
  padding: 12px 16px;
}
.internal-comments-panel .internal-comments-panel-title {
  font-size: 16px;
}
.internal-comments-panel .internal-comments-list {
  margin-bottom: 14px;
  padding-bottom: 10px; /* last message bottom border visible, not cut off */
  min-height: 0;
  overflow-y: auto;
}
.internal-comments-panel .conversation-item-internal {
  padding: 10px 12px;
  margin-left: 36px;
  margin-bottom: 8px;
  border-radius: 6px;
}
.internal-comments-panel .internal-comments-timeline .conversation-item-internal {
  padding-left: 14px;
}
.internal-comments-panel .internal-comment-marker {
  left: -32px;
  top: 18px;
  width: 8px;
  height: 8px;
  border-width: 1.5px;
}
.internal-comments-panel .conversation-avatar,
.internal-comments-panel .avatar-initials {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.internal-comments-panel .conversation-avatar-system .avatar-icon-system {
  width: 16px;
  height: 16px;
}
.internal-comments-panel .conversation-header {
  margin-bottom: 4px;
  gap: 6px;
}
.internal-comments-panel .conversation-author strong {
  font-size: 13px;
}
.internal-comments-panel .conversation-badge-internal {
  padding: 1px 6px;
  font-size: 10px;
}
.internal-comments-panel .conversation-date {
  font-size: 12px;
}
.internal-comments-panel .internal-comment-body {
  font-size: 13px;
  line-height: 1.45;
}
.internal-comments-panel .internal-comment-body p {
  margin-bottom: 0.35em;
}
.internal-comments-panel .internal-comments-form-label {
  font-size: 12px;
  margin-bottom: 6px;
}
.internal-comments-panel .internal-comments-form {
  padding-top: 14px;
}
.internal-comments-panel .reply-form-actions {
  margin-top: 8px;
}
.internal-comments-panel .reply-textarea {
  min-height: 88px;
  font-size: 13px;
}
/* Compact EasyMDE inside internal comments panel */
.internal-comments-panel .EasyMDEContainer {
  margin-bottom: 8px;
}
.internal-comments-panel .EasyMDEContainer .CodeMirror {
  font-size: 13px;
  min-height: 100px;
  max-height: 200px;
  padding: 8px;
  border-radius: 0 0 6px 6px;
  overflow-y: auto !important;
}
.internal-comments-panel .EasyMDEContainer .editor-toolbar {
  padding: 4px 6px;
}
.internal-comments-panel .EasyMDEContainer .editor-toolbar button {
  padding: 2px 6px;
  margin: 0 1px;
}
.internal-comments-panel .EasyMDEContainer .CodeMirror-scroll {
  max-height: 200px;
}
.internal-comments-panel .internal-comments-empty {
  padding: 32px 16px;
}
.internal-comments-panel .internal-comments-empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.internal-comments-panel .internal-comments-empty-title {
  font-size: 15px;
  margin-bottom: 6px;
}
.internal-comments-panel .internal-comments-empty-hint {
  font-size: 13px;
}
.support_button_grey {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.support_button_grey:hover {
  background-color: var(--bg-primary);
}
.support_resetbtn {
  margin-left: 4px;
}
.tickets-table th .sortable-th {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}
.tickets-table th .sortable-th:hover {
  color: var(--accent);
}
/* Alerts */
.alert {
  padding: 14px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid;
}
.alert-notice {
  background-color: rgba(74, 158, 255, 0.1);
  border-color: rgba(74, 158, 255, 0.3);
  color: var(--accent);
}
.alert-error {
  background-color: rgba(244, 135, 113, 0.1);
  border-color: rgba(244, 135, 113, 0.3);
  color: #F48771;
}
.alert-flash {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: opacity 0.28s ease, transform 0.28s ease, max-height 0.28s ease, margin 0.28s ease, padding 0.28s ease;
  max-height: 120px;
  overflow: hidden;
}
.alert-flash-message {
  flex: 1;
  min-width: 0;
}
.alert-flash-close {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  background: none;
  border: none;
  padding: 0 2px;
  margin: -2px 0 0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  flex-shrink: 0;
}
.alert-flash-close:hover {
  opacity: 1;
}
.alert-flash.is-dismissing {
  opacity: 0;
  transform: translateY(-4px);
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}
/* Staging DB refresh terminal */
.staging-db-refresh-cmd {
  margin: 6px 0 0;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
}
.staging-db-refresh-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.staging-db-refresh-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.staging-db-refresh-status-chip[data-status="queued"],
.staging-db-refresh-status-chip[data-status="running"] {
  background: rgba(74, 158, 255, 0.12);
  border-color: rgba(74, 158, 255, 0.35);
  color: var(--accent);
}
.staging-db-refresh-status-chip[data-status="succeeded"] {
  background: rgba(46, 125, 50, 0.12);
  border-color: rgba(46, 125, 50, 0.35);
  color: #2E7D32;
}
.staging-db-refresh-status-chip[data-status="failed"] {
  background: rgba(198, 40, 40, 0.1);
  border-color: rgba(198, 40, 40, 0.35);
  color: #c62828;
}
.staging-db-refresh-error {
  font-size: 13px;
  color: #c62828;
}
.staging-db-refresh-terminal {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0f1419;
  color: #d7e0ea;
  max-width: 960px;
}
.staging-db-refresh-terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  color: #8b949e;
}
.staging-db-refresh-terminal-hint {
  font-weight: 400;
}
.staging-db-refresh-terminal-body {
  margin: 0;
  padding: 12px 14px;
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.staging-db-refresh-history {
  list-style: none;
  margin: 0;
  padding: 0;
}
.staging-db-refresh-history li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.staging-db-refresh-history li:last-child {
  border-bottom: none;
}
.staging-db-refresh-history-meta {
  color: var(--text-secondary);
  font-size: 12px;
}
/* Pagination - Modern Style */
.pagination-wrapper {
  margin-top: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.pagination-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.pagination-text {
  font-weight: 500;
  color: var(--text-primary);
}
.pagination-count {
  color: var(--text-muted);
}
.pagination-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}
.pagination-btn:hover:not(.pagination-btn-disabled) {
  background-color: var(--hover-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.pagination-btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background-color: var(--bg-secondary);
}
.pagination-btn svg {
  width: 16px;
  height: 16px;
}
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 8px;
}
.pagination-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}
.pagination-page:hover:not(.pagination-page-current) {
  background-color: var(--hover-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.pagination-page-current {
  background-color: var(--accent);
  border-color: var(--accent);
  color: white;
  cursor: default;
}
.pagination-gap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 0 4px;
}
/* Responsive pagination */
@media (max-width: 768px) {
  .pagination-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-info {
    justify-content: center;
    order: 2;
    margin-top: 12px;
  }

  .pagination-nav {
    justify-content: center;
    order: 1;
  }

  .pagination-pages {
    margin: 0 4px;
  }

  /* Hide some page numbers on mobile */
  .pagination-page:not(.pagination-page-current):not(:first-child):not(:last-child) {
    display: none;
  }
}
/* Links */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}
/* Headings */
h1, h2, h3 {
  color: var(--text-primary);
  font-weight: 600;
}
h1 {
  font-size: 32px;
}
h2 {
  font-size: 20px;
}
/* Footer - Vercel Style */
.app-footer {
  background-color: var(--bg-header);
  border-top: 1px solid var(--border);
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.footer-logo {
  width: 16px;
  height: 16px;
  background-color: var(--accent);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 10px;
}
.footer-nav {
  display: flex;
  gap: 16px;
}
.footer-nav a {
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
}
.footer-nav a:hover {
  color: var(--text-primary);
}
.footer-right {
  color: var(--text-secondary);
  font-size: 13px;
}
/* Login */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: var(--bg-primary);
}
.login-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px;
  width: 100%;
  max-width: 420px;
}
.login-card h1 {
  margin-bottom: 8px;
  text-align: center;
}
.login-card p {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 32px;
}
/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
/* Canned Responses Page */
.canned-responses-page {
  max-width: 960px;
  margin: 0 auto;
}
.canned-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.canned-filter-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.canned-filter-search {
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 280px;
}
.canned-filter-select {
  max-width: 180px;
}
.canned-scope-counts {
  color: var(--text-muted);
}
.owner-badge {
  display: inline-block;
  padding: 2px 7px;
  background-color: rgba(120, 130, 140, 0.15);
  color: var(--text-secondary);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.owner-badge-mine {
  background-color: rgba(74, 158, 255, 0.12);
  color: var(--accent);
}
/* Dense reply list */
.canned-responses-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--bg-card);
}
.canned-response-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s;
}
.canned-response-row[hidden] {
  display: none;
}
.canned-responses-list > .empty-state[hidden] {
  display: none;
}
.canned-response-row:last-child {
  border-bottom: none;
}
.canned-response-row:hover {
  background-color: var(--hover-bg);
}
.canned-response-main {
  flex: 1;
  min-width: 0;
}
.canned-response-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.canned-response-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  word-wrap: break-word;
}
.canned-response-preview {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.canned-response-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.canned-response-actions form {
  display: inline;
  margin: 0;
}
.category-badge {
  display: inline-block;
  padding: 2px 7px;
  background-color: rgba(74, 158, 255, 0.15);
  color: var(--accent);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.action-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  padding: 0;
}
.action-btn:hover {
  background-color: var(--bg-card);
  border-color: var(--border);
  color: var(--accent);
}
.action-btn svg {
  width: 16px;
  height: 16px;
}
.action-delete:hover {
  background-color: rgba(244, 67, 54, 0.1);
  border-color: #EF5350;
  color: #EF5350;
}
/* Empty State */
.canned-responses-list .empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
}
.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 16px 0 8px 0;
}
.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 24px 0;
}
/* Preview Modal Specific Styles */
.modal-content-preview {
  max-width: 600px;
}
.preview-meta {
  margin-bottom: 16px;
}
.preview-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 24px;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
}
.preview-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
/* Form Page */
.canned-response-form-page {
  max-width: 800px;
  margin: 0 auto;
}
.canned-response-form-page .page-header {
  margin-bottom: 24px;
}
.canned-response-form-page .page-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 4px 0 0 0;
}
.form-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
@media (max-width: 640px) {
  .canned-response-row {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .canned-response-actions {
    align-self: stretch;
    justify-content: flex-end;
  }

  .canned-filter-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .canned-filter-select {
    max-width: none;
    flex: 1 1 140px;
  }

  .canned-filter-search {
    flex: 1 1 100%;
  }
}
/* Markdown Content Styles */
.markdown-body,
.conversation-body {
  line-height: 1.6;
  color: var(--text-primary);
}
.markdown-body p,
.conversation-body p {
  margin: 0 0 12px 0;
}
.markdown-body p:last-child,
.conversation-body p:last-child {
  margin-bottom: 0;
}
.markdown-body h1,
.conversation-body h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 20px 0 12px 0;
  color: var(--text-primary);
}
.markdown-body h2,
.conversation-body h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 18px 0 10px 0;
  color: var(--text-primary);
}
.markdown-body h3,
.conversation-body h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 16px 0 8px 0;
  color: var(--text-primary);
}
.markdown-body h4,
.conversation-body h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 14px 0 6px 0;
  color: var(--text-primary);
}
.markdown-body code,
.conversation-body code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 13px;
  color: var(--accent);
}
.markdown-body pre,
.conversation-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  margin: 12px 0;
  line-height: 1.5;
}
/* Keep prose after a fence from sitting flush against the grey block. */
.markdown-body pre + p,
.conversation-body pre + p,
.markdown-body pre + ul,
.conversation-body pre + ul,
.markdown-body pre + ol,
.conversation-body pre + ol {
  margin-top: 12px;
}
.markdown-body pre code,
.conversation-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}
.markdown-body blockquote,
.conversation-body blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 16px;
  margin: 12px 0;
  color: var(--text-secondary);
  font-style: italic;
}
.markdown-body ul,
.markdown-body ol,
.conversation-body ul,
.conversation-body ol {
  margin: 12px 0;
  padding-left: 24px;
}
.markdown-body li,
.conversation-body li {
  margin: 6px 0;
}
.markdown-body table,
.conversation-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
}
.markdown-body th,
.markdown-body td,
.conversation-body th,
.conversation-body td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.markdown-body th,
.conversation-body th {
  background: var(--bg-secondary);
  font-weight: 600;
}
.markdown-body a,
.conversation-body a {
  color: var(--accent);
  text-decoration: none;
}
.markdown-body a:hover,
.conversation-body a:hover {
  text-decoration: underline;
}
/* External links (intercepted to open in new tab; not *.bravenet.com) */
a.external-link {
  /* Optional: small "new tab" indicator */
}
a.external-link::after {
  content: " ↗";
  font-size: 0.85em;
  opacity: 0.75;
}
.markdown-body img,
.conversation-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 12px 0;
}
.markdown-body hr,
.conversation-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
/* EasyMDE Editor Styles */
.EasyMDEContainer {
  margin-bottom: 12px;
  position: relative;
}
.EasyMDEContainer.is-dragover .CodeMirror {
  outline: 2px dashed var(--accent, #2563eb);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent, #2563eb) 8%, var(--bg-card));
}
.reply-attach-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  line-height: 1.35;
}
.EasyMDEContainer .CodeMirror {
  border: 1px solid var(--border);
  border-radius: 0 0 6px 6px; /* only bottom corners; toolbar has top radius so they meet flush */
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 14px;
  min-height: 200px;
}
.EasyMDEContainer .CodeMirror-cursor {
  border-left: 2px solid var(--text-primary);
}
/*
 * Pretty edit mode: hide Markdown delimiters so toolbar Bold/Italic looks
 * like rich text. Markers remain in the document (submit/Preview still use
 * Markdown). Toggle .is-raw-source (toolbar “Raw”) to show the source marks.
 */
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-strong,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-em,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-strikethrough,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-header,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-quote,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-code,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-link,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-link-string,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-string.cm-url {
  display: none;
}
/* Keep list markers visible in pretty mode so structure stays editable. */
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-list,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-list-ul,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-list-ol,
.EasyMDEContainer:not(.is-raw-source) .CodeMirror span.cm-formatting-task {
  display: inline;
}
/*
 * Discourse-ish HR in pretty edit mode:
 * - bare "***" on the active line stays literal (still typing)
 * - "*** " (space) or leaving the line confirms → full-width rule
 * - Backspace off the space returns to literal stars
 */
.EasyMDEContainer:not(.is-raw-source) .CodeMirror pre.CodeMirror-line.cm-hr-incomplete span.cm-hr {
  color: var(--text-muted);
  font-weight: 400;
}
.EasyMDEContainer:not(.is-raw-source) .CodeMirror pre.CodeMirror-line.cm-hr-confirmed {
  position: relative;
  min-height: 1.25em;
}
.EasyMDEContainer:not(.is-raw-source) .CodeMirror pre.CodeMirror-line.cm-hr-confirmed span.cm-hr {
  color: transparent;
}
.EasyMDEContainer:not(.is-raw-source) .CodeMirror pre.CodeMirror-line.cm-hr-confirmed::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  border-top: 1px solid var(--border);
  pointer-events: none;
}
.EasyMDEContainer.is-raw-source .CodeMirror {
  font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace;
}
.EasyMDEContainer .editor-toolbar {
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: var(--bg-secondary);
  padding: 8px;
}
.EasyMDEContainer .editor-toolbar button {
  color: var(--text-secondary);
  border: none;
  background: transparent;
  padding: 4px 8px;
  margin: 0 2px;
  border-radius: 3px;
}
.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active {
  background: var(--hover-bg);
  color: var(--text-primary);
}
.EasyMDEContainer .editor-preview {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 0 0 6px 6px;
}
.EasyMDEContainer .editor-preview-side {
  border-left: 1px solid var(--border);
}
/* Upload indicator (drag/drop or paste) */
.markdown-editor-upload-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.markdown-editor-upload-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: markdown-editor-spin 0.7s linear infinite;
}
@keyframes markdown-editor-spin {
  to { transform: rotate(360deg); }
}
.markdown-editor-upload-text {
  font-weight: 500;
}
/* Syntax Highlighting (Rouge) */
.highlight {
  background: var(--bg-secondary);
  border-radius: 4px;
  padding: 1px 4px;
}
.highlight pre {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}
.highlight table {
  border: none;
  margin: 0;
}
.highlight td {
  border: none;
  padding: 0;
}
/* Admin Settings — GitHub/Zendesk-style section nav */
.admin-settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.admin-settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 16px;
  padding: 4px 0;
}
.admin-settings-nav-item {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid transparent;
}
.admin-settings-nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.admin-settings-nav-item.is-active {
  color: var(--text-primary);
  background: var(--accent-light, #eef4ff);
  border-color: transparent;
  font-weight: 600;
}
.admin-settings-panel {
  min-width: 0;
}
.admin-settings-form {
  max-width: 680px;
}
.admin-settings-panel-header {
  margin-bottom: 8px;
}
.admin-settings-panel-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}
.admin-settings-panel-lead {
  margin: 0;
}
/*
 * Flat setting sections — even 24px rhythm around dividers so gaps stay
 * consistent above/below rules and between fields.
 */
.admin-settings-group {
  margin: 0;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  background: transparent;
}
.admin-settings-group:first-of-type {
  border-top: none;
  padding-top: 16px;
}
.admin-settings-group-header {
  margin-bottom: 16px;
  padding: 0;
  border: none;
  background: transparent;
}
.admin-settings-group-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.admin-settings-group-lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.admin-settings-group-body {
  padding: 0;
}
.admin-settings-group-body .form-group {
  margin-bottom: 16px;
}
.admin-settings-group-body .form-group:last-child {
  margin-bottom: 0;
}
.admin-settings-group-body .form-hint,
.admin-settings-group-body .form-group > .form-hint {
  margin-top: 6px;
}
.admin-settings-form-actions {
  margin-top: 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
@media (max-width: 768px) {
  .admin-settings-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .admin-settings-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }

  .admin-settings-nav-item {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-card, #fff);
  }

  .admin-settings-nav-item.is-active {
    border-color: var(--accent);
    background: var(--accent-light, #eef4ff);
    color: var(--accent);
  }

  .admin-settings-form {
    max-width: none;
  }
}
/* Admin staff profile hub */
.admin-user-profile-deleted-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.admin-user-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.admin-user-profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.admin-user-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  -o-object-fit: cover;
     object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.admin-user-profile-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
}
.admin-user-profile-identity-copy {
  min-width: 0;
}
.admin-user-profile-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 4px;
}
.admin-user-profile-title-row h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.admin-user-profile-title-row .badge {
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.3;
  vertical-align: middle;
}
.admin-user-profile-username {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.admin-user-profile-dept {
  color: var(--text-secondary);
}
.admin-user-profile-meta-sep {
  color: var(--border);
}
.admin-user-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
/* Soft delete is button_to → <form><button>; links are <a class="btn">.
   Native button padding made Soft delete taller than Edit / Back. */
.admin-user-profile-actions .button_to {
  margin: 0;
  display: inline-flex;
  align-items: center;
}
.admin-user-profile-actions .btn {
  box-sizing: border-box;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  line-height: 1;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.admin-user-profile .stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.admin-user-profile .stats-kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.admin-user-profile .stats-kpi-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.admin-user-profile .stats-kpi-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.admin-user-profile-stats-link {
  margin: 0 0 20px;
  font-size: 13px;
}
.admin-user-profile-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 20px;
  align-items: start;
}
.admin-user-profile-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  min-width: 0;
}
.admin-user-profile-panel-title {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.admin-user-profile-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.admin-user-profile-panel-header .admin-user-profile-panel-title {
  margin-bottom: 0;
}
.admin-user-profile-csat {
  margin-top: 20px;
}
.admin-user-profile-csat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.admin-user-profile-csat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.admin-user-profile-csat-row:first-child {
  padding-top: 0;
}
.admin-user-profile-csat-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.admin-user-profile-csat-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.admin-user-profile-csat-detail {
  font-size: 13px;
  color: var(--text-secondary);
}
.admin-user-profile-subhead {
  margin: 20px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.admin-user-profile-dl {
  margin: 0;
  display: grid;
  gap: 12px;
}
.admin-user-profile-dl > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px;
  font-size: 14px;
}
.admin-user-profile-dl dt {
  margin: 0;
  color: var(--text-secondary);
  font-weight: 500;
}
.admin-user-profile-dl dd {
  margin: 0;
  color: var(--text-primary);
  word-break: break-word;
}
.admin-user-profile-signature {
  margin: 0;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
  font-family: inherit;
  max-height: 160px;
  overflow: auto;
}
.admin-user-profile-ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.admin-user-profile-ticket-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.admin-user-profile-ticket-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.admin-user-profile-ticket-row:first-child {
  padding-top: 0;
}
.admin-user-profile-ticket-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.admin-user-profile-ticket-name {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-user-profile-ticket-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.admin-user-profile-ticket-time {
  font-size: 12px;
  color: var(--text-secondary);
}
@media (max-width: 900px) {
  .admin-user-profile .stats-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 768px) {
  .admin-user-profile-body {
    grid-template-columns: 1fr;
  }

  .admin-user-profile-dl > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .admin-user-profile-ticket-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-user-profile-ticket-meta {
    align-items: flex-start;
    flex-direction: row;
    gap: 8px;
  }
}
/* Admin Pages - Vercel-style */
.admin-page {
  max-width: none;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.admin-header-left {
  flex: 1;
  min-width: 0;
}
.admin-header-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.admin-header-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.admin-header .header-right {
  flex: 0 0 auto;
  padding-right: 0;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.admin-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
  display: block;
}
.admin-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--shadow);
}
.admin-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--accent);
}
.admin-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}
.admin-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}
.admin-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (min-width: 768px) {
  .admin-status-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.admin-status-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}
.admin-status-label {
  font-size: 12px;
}
.profile-avatar-preview {
  text-align: center;
  padding: 24px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  margin-top: 8px;
}
.profile-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  -o-object-fit: cover;
     object-fit: cover;
  display: block;
  margin: 0 auto;
}
.profile-avatar-initials {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  margin: 0 auto;
}
.admin-status-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}
.admin-status-value-online {
  color: #81C784;
}
.admin-status-value-offline {
  color: #EF5350;
}
.system-status-overall-warn {
  color: #F0A500;
}
.system-status-table-wrap {
  max-width: 960px;
  padding: 0;
  overflow: hidden;
}
.system-status-table {
  width: 100%;
  margin: 0;
}
.system-status-table th,
.system-status-table td {
  padding: 12px 16px;
  vertical-align: top;
}
.system-status-detail {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-word;
}
.system-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
}
.system-status-badge-ok {
  background: rgba(129, 199, 132, 0.2);
  color: #81C784;
}
.system-status-badge-warn {
  background: rgba(240, 165, 0, 0.18);
  color: #F0A500;
}
.system-status-badge-fail {
  background: rgba(239, 83, 80, 0.18);
  color: #EF5350;
}
.admin-form-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  max-width: none;
}
.admin-form-card .form-control {
  max-width: 36rem;
}
.admin-form-card textarea.form-control {
  max-width: none;
}
.admin-form-card.admin-settings-form {
  max-width: 680px;
}
.admin-jobs-page .admin-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.admin-jobs-page .admin-table th,
.admin-jobs-page .admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}
.admin-jobs-page .admin-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.admin-jobs-page .admin-failures .col-status { width: 6rem; }
.admin-jobs-page .admin-failures .col-when { width: 12rem; white-space: nowrap; }
.admin-jobs-page .admin-failures .col-job { width: 22rem; }
.admin-job-name {
  display: block;
  font-weight: 600;
}
.admin-job-detail {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
}
.admin-jobs-page .admin-job-error {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.admin-job-error details {
  margin-top: 6px;
}
.admin-job-error summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
}
.admin-job-error pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  max-height: 160px;
  overflow: auto;
}
.agent-signature-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.agent-signature-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 12px;
}
.agent-signature-rows:has(.agent-signature-row) {
  max-height: min(360px, 50vh);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-primary, #fff);
}
.agent-signature-rows-head {
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.agent-signature-rows-head-title,
.agent-signature-rows-head-preview {
  min-width: 0;
}
.agent-signature-row {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 0;
}
.agent-signature-row:last-child {
  border-bottom: 0;
}
.agent-signature-row.is-expanded {
  background: var(--bg-secondary);
}
.agent-signature-row-summary {
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 7px 12px;
  cursor: pointer;
}
.agent-signature-row-summary:hover {
  background: color-mix(in srgb, var(--accent, #3b82f6) 8%, transparent);
}
.agent-signature-row-copy {
  min-width: 0;
  display: contents;
}
.agent-signature-row-title {
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.agent-signature-row-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-signature-row-badge {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent, #2563eb);
  background: color-mix(in srgb, var(--accent, #3b82f6) 14%, transparent);
  border-radius: 999px;
  padding: 1px 6px;
  white-space: nowrap;
}
.agent-signature-row-badge[hidden] {
  display: none !important;
}
.agent-signature-default-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
.agent-signature-default-check input {
  margin: 0;
}
.agent-signature-row-preview {
  min-width: 0;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-signature-row-preview-empty {
  font-style: italic;
}
.agent-signature-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  grid-column: 3;
}
.agent-signature-row-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: 4px;
}
.agent-signature-row-status.is-error {
  color: var(--danger, #b42318);
}
.agent-signature-row-editor {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}
.agent-signature-row-editor .form-group {
  margin-bottom: 10px;
}
.agent-signature-row.is-expanded .agent-signature-row-summary {
  display: none;
}
@media (max-width: 720px) {
  .agent-signature-rows-head {
    display: none;
  }

  .agent-signature-row-summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .agent-signature-row-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .agent-signature-row-actions {
    grid-column: auto;
  }
}
.admin-user-profile-signature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-user-profile-signature-list li strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}
.profile-form-card {
  max-width: 100%;
}
.admin-form-section {
  margin-bottom: 24px;
}
.admin-form-section:last-child {
  margin-bottom: 0;
}
.admin-form-divider {
  height: 1px;
  background-color: var(--border);
  margin: 32px 0;
  border: none;
}
.admin-form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px 0;
}
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
  flex-wrap: wrap;
}
.admin-question-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.admin-question-row .form-group {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}
.admin-question-row label[for] {
  min-width: 90px;
  font-size: 14px;
  color: var(--text-secondary);
}
.admin-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  cursor: pointer;
}
.profile-layout-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 1024px) {
  .profile-layout-grid {
    grid-template-columns: 1fr;
  }
}
/* Profile page – clearer hierarchy, no heavy accent borders */
.profile-page .profile-page-header {
  margin-bottom: 16px;
}
.profile-page .profile-page-header .admin-header-title,
.profile-page .workspace-page-header-copy h1 {
  color: var(--text-primary);
}
.profile-page .profile-page-header .admin-header-subtitle,
.profile-page .workspace-page-header-meta {
  color: var(--text-secondary);
}
.profile-form-card {
  box-shadow: 0 1px 3px var(--shadow);
}
.profile-page .profile-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.profile-page .admin-form-divider {
  margin: 28px 0;
  background-color: var(--border);
}
.profile-page .form-actions {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.profile-page .form-actions .btn-primary {
  min-width: 140px;
}
/* Profile sidebar – purge old tickets (legacy editprofile button) */
.profile-purge-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--bg-card);
  box-shadow: 0 1px 3px var(--shadow);
  margin-bottom: 16px;
  text-align: center;
}
.profile-purge-btn {
  width: 100%;
  background: var(--bg-muted, #f1f5f9);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 600;
}
.profile-purge-btn:hover {
  background: var(--accent-light, #e8f4fc);
  border-color: var(--accent);
  color: var(--accent);
}
.profile-purge-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}
/* Profile sidebar – avatar card */
.profile-avatar-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  background: var(--bg-card);
  box-shadow: 0 1px 3px var(--shadow);
}
.profile-avatar-card-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}
.profile-page .profile-avatar-preview {
  background: var(--accent-light);
  border-radius: 12px;
  padding: 28px;
  border: 1px dashed var(--accent);
}
.profile-page .profile-avatar-img,
.profile-page .profile-avatar-initials {
  box-shadow: 0 2px 8px rgba(3, 113, 183, 0.2);
}
.profile-page .profile-avatar-initials {
  background-color: var(--accent);
  color: white;
}
.profile-page .profile-avatar-card .form-hint {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 12px;
}
/* File input (Browse) – brand styling */
.profile-page input[type="file"].form-control {
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  cursor: pointer;
}
.profile-page input[type="file"].form-control:hover {
  background: rgba(3, 113, 183, 0.15);
}
.profile-page input[type="file"].form-control::file-selector-button {
  padding: 6px 12px;
  margin-right: 12px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.profile-page input[type="file"].form-control::file-selector-button:hover {
  background: var(--accent-hover);
}
/* Profile avatar as single clickable component (file input in sidebar) */
.profile-form-wrapper {
  display: block;
}
.profile-avatar-file-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}
.profile-avatar-upload-label {
  display: block;
  cursor: pointer;
  text-align: center;
  position: relative;
}
.profile-avatar-upload-label:hover .profile-avatar-preview {
  background: rgba(3, 113, 183, 0.15);
}
.profile-avatar-upload-text {
  display: inline-block;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.profile-avatar-upload-label:hover .profile-avatar-upload-text {
  color: var(--accent-hover);
}
.profile-avatar-hint {
  margin-top: 10px;
  margin-bottom: 0;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}
/* Stats dashboard - Vercel/Freshdesk style, dense layout */
.admin-stats {
  max-width: none;
}
.admin-stats .stats-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-stats .stats-header-left {
  min-width: 0;
}
.admin-stats .stats-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 2px 0;
}
.admin-stats .stats-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.admin-stats .stats-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.admin-stats .stats-presets {
  display: flex;
  align-items: center;
  gap: 4px;
}
.admin-stats .stats-preset-link {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  text-decoration: none;
}
.admin-stats .stats-preset-link:hover {
  color: var(--accent);
  background-color: var(--hover-bg);
}
.admin-stats .stats-data-as-of {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}
.admin-stats .stats-date-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.admin-stats .stats-date-label {
  font-size: 12px;
  color: var(--text-secondary);
}
.admin-stats .stats-date-input {
  width: 130px;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.35;
}
.admin-stats .stats-date-sep {
  color: var(--text-muted);
  font-size: 12px;
}
.admin-stats .stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.admin-stats .stats-kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-stats .stats-kpi-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.admin-stats .stats-kpi-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.admin-stats .stats-delta {
  font-size: 10px;
  display: block;
  margin-top: 2px;
}
.admin-stats .stats-delta-up {
  color: var(--text-secondary);
}
.admin-stats .stats-delta-down {
  color: var(--text-secondary);
}
.admin-stats .stats-sparkline {
  margin-top: 4px;
  opacity: 0.7;
  color: var(--text-muted);
}
.admin-stats .stats-sparkline svg {
  display: block;
}
.admin-stats .stats-status-dept-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 20px;
  padding: 12px 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.admin-stats .stats-strip-section {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-stats .stats-strip-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.admin-stats .stats-strip-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.admin-stats .stats-strip-item {
  font-size: 12px;
  color: var(--text-primary);
}
.admin-stats .stats-strip-item strong {
  font-weight: 600;
}
.admin-stats .stats-strip-more {
  color: var(--text-muted);
}
.admin-stats .stats-recurrence-panel {
  margin-bottom: 20px;
}
.admin-stats .stats-recurrence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.admin-stats .stats-recurrence-list li {
  color: var(--text-primary);
}
.admin-stats .stats-recurrence-topic {
  color: var(--text-secondary);
}
.admin-stats .stats-main-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .admin-stats .stats-main-grid {
    grid-template-columns: 1fr;
  }
}
.admin-stats .stats-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  min-height: 0;
}
.admin-stats .stats-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.admin-stats .stats-chart-wrap {
  position: relative;
  height: 220px;
  width: 100%;
}
.admin-stats .stats-bar-chart {
  display: block;
  width: 100%;
  height: 220px;
}
.admin-stats .stats-bar-chart-bar {
  fill: rgba(74, 158, 255, 0.65);
}
.admin-stats .stats-bar-chart-bar:hover {
  fill: rgba(74, 158, 255, 0.95);
}
.admin-stats .stats-bar-chart-axis {
  stroke: var(--border-color, rgba(0, 0, 0, 0.12));
  stroke-width: 1;
}
.admin-stats .stats-bar-chart-label {
  fill: var(--text-secondary, #6B7280);
  font-size: 9px;
}
.admin-stats .stats-chart-panel {
  min-height: 260px;
}
.admin-stats .stats-backlog-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 18px;
  margin: 0 0 20px;
  padding: 12px 16px;
  background: var(--surface-secondary, #f8f9fb);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
}
.admin-stats .stats-secondary-grid {
  margin-top: 20px;
}
.admin-stats .stats-hbar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-stats .stats-hbar-row {
  display: grid;
  grid-template-columns: minmax(96px, 140px) 1fr 48px;
  gap: 10px;
  align-items: center;
}
.admin-stats .stats-hbar-label {
  font-size: 12px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-stats .stats-hbar-track {
  height: 10px;
  background: var(--surface-secondary, #eef1f5);
  border-radius: 999px;
  overflow: hidden;
}
.admin-stats .stats-hbar-fill {
  display: block;
  height: 100%;
  background: rgba(74, 158, 255, 0.7);
  border-radius: 999px;
  min-width: 2px;
}
.admin-stats .stats-hbar-count {
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  color: var(--text-primary);
}
.admin-stats .stats-filter-form {
  flex-wrap: wrap;
}
.admin-stats .stats-filter-select {
  min-width: 140px;
  max-width: 220px;
  height: auto;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.35;
}
.admin-stats .stats-filter-active {
  color: var(--text-primary);
  font-weight: 600;
}
.admin-stats .stats-filter-clear,
.admin-stats .stats-breadcrumb {
  margin: 4px 0 0;
  font-size: 13px;
}
.admin-stats .stats-agents-panel .stats-table-wrap {
  max-height: 280px;
  overflow-y: auto;
}
.admin-stats .stats-table-wrap {
  overflow-x: auto;
}
.admin-stats .stats-table th,
.admin-stats .stats-table td {
  padding: 8px 14px;
  font-size: 13px;
}
.admin-stats .stats-th-num,
.admin-stats .stats-td-num {
  text-align: right;
  width: 72px;
}
.admin-stats .stats-empty {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  padding: 12px 0;
}
.admin-stats .stats-empty-state {
  padding: 24px 0;
  text-align: center;
}
.admin-stats .stats-empty-state-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 6px 0;
}
.admin-stats .stats-empty-state-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.admin-stats .stats-daily-panel {
  margin-bottom: 0;
}
.admin-stats .stats-pagination {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
/* contact-card-avatar-img sizing lives with .contact-card-avatar above */
.contact-card-bn-tools,
.contact-card-link-account {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
/* Zendesk/Freshdesk-style customer context: one primary CTA, then quiet full-width links. */
.bn-login-dropdown {
  position: relative;
  display: block;
  width: 100%;
}
.bn-login-group {
  display: flex;
  width: 100%;
  align-items: stretch;
}
.bn-login-primary {
  flex: 1 1 auto;
  justify-content: center;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.bn-login-group .bn-login-primary.btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.bn-login-toggle {
  flex: 0 0 auto;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  padding-left: 0.55rem;
  padding-right: 0.55rem;
  min-width: 2rem;
}
.bn-login-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  padding: 4px;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}
.bn-login-menu-item {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.875rem;
}
.bn-login-menu-item:hover {
  background: var(--surface-muted, #f3f4f6);
}
.bn-tool-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}
.bn-tool-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  box-sizing: border-box;
}
.bn-tool-link:hover {
  background: var(--surface-muted, #f3f4f6);
  color: var(--text);
}
.bn-tool-link-hint {
  color: var(--text-secondary, #6b7280);
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.7;
}
.pre-answer-panel {
  margin-bottom: 16px;
  padding: 16px 18px;
  background: #f7f9fb;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.pre-answer-title {
  margin: 0 0 8px;
  font-size: 1rem;
}
.pre-answer-status {
  margin: 0 0 12px;
  color: var(--text-secondary);
}
.pre-answer-draft {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  white-space: pre-wrap;
}
.pre-answer-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.pre-answer-item {
  margin: 0 0 10px;
}
.pre-answer-item p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.pre-answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* Branded error pages — same centered auth-style layout as login */
.error-page {
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
}
.error-page-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 32px 20px;
  gap: 20px;
}
.error-page-brand {
  display: inline-flex;
  line-height: 0;
  text-decoration: none;
}
.error-page-logo {
  height: 32px;
  width: auto;
  display: block;
}
.error-page-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.error-page-code {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  opacity: 0.22;
  margin: 0 0 12px;
}
.error-page-headline {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 10px;
  color: var(--text-primary);
}
.error-page-message {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 24px;
}
.error-page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

