:root {
  --mt-primary: #5955d1;
  --app-menubar-tabs: 250px;
}

html[data-app-sidebar="mini"] {
  --app-menubar-tabs: 80px;
}

html[data-app-sidebar="mini-hover"] {
  --app-menubar-tabs: 250px;
}

.mt-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.16em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn .mt-icon,
.dropdown-item .mt-icon,
.side-menubar .menu-link .mt-icon {
  margin-right: 0.35rem;
}

.btn-icon .mt-icon {
  margin-right: 0;
}

.avatar span,
.mt-logo-mark,
.brand-mark {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: var(--mt-primary);
  color: #fff;
  font-weight: 800;
}

.mt-logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  text-decoration: none;
}

.navbar-brand-logo {
  text-decoration: none;
}

.mt-single-sidebar .app-side-brands {
  height: var(--app-header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
}

.mt-single-sidebar .app-content-inner {
  height: calc(100vh - var(--app-header-height));
}

.mt-single-sidebar .app-navbar {
  height: 100%;
}

body:has(.mt-single-sidebar) .app-header {
  padding-left: var(--app-menubar-tabs);
}

body:has(.mt-single-sidebar) .app-wrapper {
  margin-left: var(--app-menubar-tabs);
  width: calc(100% - var(--app-menubar-tabs));
  max-width: calc(100% - var(--app-menubar-tabs));
  box-sizing: border-box;
  overflow-x: hidden;
}

body:has(.mt-single-sidebar) .app-wrapper > .container-fluid {
  padding-top: 14px;
  padding-bottom: 14px;
}

body:has(.mt-single-sidebar) .card {
  --bs-card-height: auto;
  margin-bottom: 12px;
}

body:has(.mt-single-sidebar) .card-header {
  padding-top: 14px;
}

body:has(.mt-single-sidebar) .card-body {
  padding-top: 14px;
  padding-bottom: 14px;
}

body:has(.mt-single-sidebar) .app-page-head {
  margin-bottom: 14px;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/" !important;
}

.theme-btn.icon-btn {
  display: inline-flex;
  width: 74px;
  height: 40px;
  border-radius: 50px;
  padding: 0;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.theme-btn .theme-icon-light,
.theme-btn .theme-icon-dark {
  display: grid;
  place-items: center;
  flex: 0 0 37px;
  width: 37px;
  height: 40px;
  position: relative;
  z-index: 2;
  transform: none;
  transition: color 0.2s ease;
}

.theme-btn .theme-icon-light .mt-icon,
.theme-btn .theme-icon-dark .mt-icon {
  margin: 0;
  width: 18px;
  height: 18px;
}

.theme-btn::after {
  left: 3px;
  top: 3px;
  height: 34px;
  width: 34px;
}

.theme-btn.active::after {
  left: 37px;
}

.theme-btn .theme-icon-light {
  color: var(--bs-primary);
}

.theme-btn .theme-icon-dark {
  color: var(--bs-body-color);
}

.theme-btn.active .theme-icon-light {
  color: var(--bs-body-color);
}

.theme-btn.active .theme-icon-dark {
  display: inline-flex;
}

[data-bs-theme="dark"] .text-dark {
  color: var(--bs-heading-color) !important;
}

[data-bs-theme="dark"] body {
  background-color: var(--custom-body-bg);
}

[data-bs-theme="dark"] .app-header,
[data-bs-theme="dark"] .mt-single-sidebar,
[data-bs-theme="dark"] .app-menubar-tabs,
[data-bs-theme="dark"] .app-side-brands {
  background-color: var(--app-header-bg);
  border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .app-wrapper {
  background-color: var(--custom-body-bg);
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .ticket-attachment-field,
[data-bs-theme="dark"] .mention-menu {
  background-color: var(--bs-body-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: var(--bs-tertiary-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .form-control::placeholder {
  color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--bs-body-color);
  --bs-table-border-color: var(--bs-border-color);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.04);
}

[data-bs-theme="dark"] .side-menubar .menu-link,
[data-bs-theme="dark"] .navbar-brand-text,
[data-bs-theme="dark"] .breadcrumb-item.active {
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .mt-single-sidebar .side-menubar .menu-link.active,
[data-bs-theme="dark"] .mt-single-sidebar .side-menubar .menu-link:hover {
  color: var(--bs-primary);
  background-color: rgba(var(--bs-primary-rgb), 0.12);
}

[data-bs-theme="dark"] .app-toggler svg path {
  stroke: var(--bs-heading-color);
}

html[data-app-sidebar="mini"] body:has(.mt-single-sidebar) .app-header,
html[data-app-sidebar="mini-hover"] body:has(.mt-single-sidebar) .app-header {
  padding-left: var(--app-menubar-tabs);
}

html[data-app-sidebar="mini"] body:has(.mt-single-sidebar) .app-wrapper,
html[data-app-sidebar="mini-hover"] body:has(.mt-single-sidebar) .app-wrapper {
  margin-left: var(--app-menubar-tabs);
}

html[data-app-sidebar="mini"] .mt-single-sidebar .navbar-brand-text,
html[data-app-sidebar="mini"] .mt-single-sidebar .menu-label {
  display: none;
}

html[data-app-sidebar="mini"] .mt-single-sidebar .app-side-brands {
  justify-content: center;
  padding-inline: 0;
}

html[data-app-sidebar="mini"] .mt-single-sidebar .side-menubar .menu-heading {
  min-height: 14px;
  margin-block: 1rem 0.5rem;
}

html[data-app-sidebar="mini"] .mt-single-sidebar .side-menubar .menu-item .menu-link {
  justify-content: center;
}

html[data-app-sidebar="mini"] .mt-single-sidebar .side-menubar .menu-link .mt-icon {
  margin-right: 0;
}

.mt-single-sidebar .side-menubar .menu-item .menu-link {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--bs-heading-color);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.mt-single-sidebar .side-menubar .menu-item .menu-link .mt-icon {
  color: var(--bs-body-color);
  transition: color 0.2s ease;
}

.mt-single-sidebar .side-menubar .menu-item .menu-link:hover,
.mt-single-sidebar .side-menubar .menu-item .menu-link.active {
  color: var(--bs-primary);
  background-color: rgba(var(--bs-primary-rgb), 0.1);
}

.mt-single-sidebar .side-menubar .menu-item .menu-link:hover .mt-icon,
.mt-single-sidebar .side-menubar .menu-item .menu-link.active .mt-icon {
  color: var(--bs-primary);
}

.app-toggler svg {
  transition: transform 0.2s ease;
}

.app-toggler.active svg,
html[data-app-sidebar="mini"] .app-toggler svg {
  transform: rotate(180deg);
}

.value-badge {
  color: var(--badge-color);
  background: color-mix(in srgb, var(--badge-color) 13%, transparent);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.title-link {
  display: block;
  min-width: 220px;
  max-width: 480px;
  color: var(--mt-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-link:hover {
  color: var(--mt-primary);
}

.overdue td {
  background: rgba(239, 68, 68, 0.045);
}

.overdue td:first-child {
  border-left: 3px solid #ef4444;
}

.col-hidden {
  display: none;
}

.ticket-grid th {
  cursor: pointer;
  user-select: none;
}

.ticket-grid th.dragging {
  opacity: 0.35;
}

.ticket-grid tbody tr {
  cursor: pointer;
}

.ticket-grid td:has(.grid-inline-control) {
  min-width: 132px;
}

.grid-inline-control {
  min-width: 120px;
  border-radius: 8px;
}

.grid-inline-control[type="number"] {
  min-width: 92px;
}

.grid-inline-control.is-saving {
  opacity: 0.65;
}

.grid-inline-control.is-saved {
  border-color: #16a34a;
  box-shadow: 0 0 0 0.15rem rgba(22, 163, 74, 0.12);
}

.ticket-grid th[data-sort-dir="asc"]::after {
  content: "  ^";
}

.ticket-grid th[data-sort-dir="desc"]::after {
  content: "  v";
}

.column-picker[hidden] {
  display: none;
}

.ticket-filters .form-control,
.ticket-filters .form-select {
  width: auto;
}

.column-picker:not([hidden]) {
  display: flex;
}

.column-picker label {
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  color: var(--bs-secondary-color);
  padding: 2.5rem;
}

.detail-label {
  display: block;
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  margin-bottom: 0.15rem;
}

.description-full {
  white-space: normal;
  line-height: 1.45;
}

.ticket-detail-main hr {
  margin: 0.9rem 0;
}

.ticket-detail-main .row {
  --bs-gutter-y: 0.85rem;
}

.ticket-detail-page .empty-state {
  padding: 1rem;
}

.ticket-detail-page textarea.form-control {
  min-height: 96px;
}

.ticket-form-layout {
  --bs-gutter-y: 0.9rem;
  max-width: 100%;
  margin-right: 0;
  margin-left: 0;
}

.ticket-form-layout > [class*="col-"] {
  min-width: 0;
}

.ticket-description-field {
  min-height: 260px;
}

.ticket-attachment-field {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  background: var(--bs-body-bg);
}

.ticket-form-compact-fields {
  padding-top: 0.15rem;
}

.ticket-form-compact-fields .form-label {
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
}

.ticket-form-compact-fields .form-control,
.ticket-form-compact-fields .form-select {
  min-height: 38px;
  width: 100%;
}

.discussion.deleted {
  opacity: 0.65;
}

.discussion {
  padding: 1rem 0;
  border-bottom: 1px solid var(--bs-border-color);
}

.discussion-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.55rem;
}

.discussion-head span,
.attachment small,
.timeline-item p {
  color: var(--bs-secondary-color);
  font-size: 0.78rem;
}

.discussion-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.discussion-actions form {
  display: inline;
}

.link-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--mt-primary);
  font-size: 0.78rem;
}

.link-button.danger {
  color: #dc2626;
}

.mention {
  color: #168746;
  font-weight: 700;
}

[data-bs-theme="dark"] .mention {
  color: #45c77a;
}

.mention-composer {
  position: relative;
}

.mention-menu {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(100% + 0.4rem);
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  background: var(--bs-body-bg);
  box-shadow: 0 14px 30px rgba(12, 36, 60, 0.14);
}

.mention-menu[hidden] {
  display: none;
}

.mention-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 0;
  border-radius: 6px;
  padding: 0.55rem 0.6rem;
  color: var(--bs-body-color);
  background: transparent;
  text-align: left;
}

.mention-menu button:hover,
.mention-menu button.active {
  color: #168746;
  background: rgba(22, 135, 70, 0.1);
}

.attachment {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--bs-border-color);
}

.attachment > div {
  min-width: 0;
  flex: 1;
}

.attachment a {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: rgba(89, 85, 209, 0.09);
  color: var(--mt-primary);
  text-decoration: none;
}

.icon-btn.danger {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

.timeline {
  position: relative;
  padding: 1.25rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 0.75rem;
  padding-bottom: 1.4rem;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border: 3px solid rgba(89, 85, 209, 0.25);
  background: var(--mt-primary);
  border-radius: 50%;
  margin-top: 0.25rem;
}

.change {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.change span {
  padding: 0.35rem 0.5rem;
  background: var(--bs-tertiary-bg);
  border-radius: 0.4rem;
}

.brand-login {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

@media (max-width: 700px) {
  body:has(.mt-single-sidebar) .app-header {
    padding-left: 0;
  }

  body:has(.mt-single-sidebar) .app-wrapper {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }

  .mt-single-sidebar {
    left: calc(-1 * var(--app-menubar-tabs));
  }

  .mt-single-sidebar.open {
    left: 0;
  }

  .title-link {
    max-width: 300px;
  }

  .ticket-filters,
  .ticket-filters .form-control,
  .ticket-filters .form-select {
    width: 100%;
  }
}
