/* App-specific overrides for CoreUI light theme.
   CoreUI sets --cui-sidebar-occupy-* on .sidebar siblings when visible;
   do not pin those variables on :root or hide/collapse cannot expand content. */

:root {
  --cui-border-color: #eeeff3;
}

body {
  background-color: rgba(var(--cui-light-rgb), .45) !important;
}

.wrapper {
  width: 100%;
  padding-inline: var(--cui-sidebar-occupy-start, 0) var(--cui-sidebar-occupy-end, 0);
  will-change: padding;
  transition: padding 0.15s ease;
}

:root {
  --app-topbar-height: 4.75rem;
  --app-topbar-padding-y: 0.875rem;
  --app-topbar-padding-x: 1rem;
}

/* Same box model on both sides so the bottom border is one continuous line. */
.sidebar-header,
.header {
  box-sizing: border-box;
  height: var(--app-topbar-height);
  min-height: var(--app-topbar-height);
  max-height: var(--app-topbar-height);
  border-bottom: var(--cui-border-width, 1px) solid var(--cui-border-color);
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: var(--app-topbar-padding-y) var(--app-topbar-padding-x);
}

.sidebar-brand .app-brand {
  margin-inline-start: 0;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.425rem;
  color: inherit;
  line-height: 1;
  white-space: nowrap;
}

.app-brand-icon {
  display: block;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.45rem;
  object-fit: contain;
}

.app-brand-logo {
  display: block;
  height: 1.1rem;
  width: auto;
  max-width: 10rem;
  object-fit: contain;
}

.app-brand-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--cui-body-color, inherit);
}

.header {
  display: flex;
  align-items: stretch;
}

.header > .container-fluid {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding-block: var(--app-topbar-padding-y);
  padding-inline: var(--app-topbar-padding-x) 1.25rem;
  border-bottom: 0;
}

.header-toggler {
  margin-inline-end: 0.75rem;
}

/* Brand next to the toggler when the sidebar is collapsed/hidden (sidebar owns the brand when open). */
.header-brand {
  margin-inline-end: 0.75rem;
}

@media (min-width: 992px) {
  body:not(.no-sidebar) .header-brand {
    display: none;
  }

  #sidebar.hide ~ .wrapper .header-brand {
    display: inline-flex;
  }
}

[data-member-suggestions] {
  display: none;
}

.profile-avatar {
  display: block;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.profile-avatar-xs {
  width: 1.75rem;
  height: 1.75rem;
}

.profile-avatar-md {
  width: 4rem;
  height: 4rem;
}

.header-nav .dropdown-menu {
  min-width: 11rem;
  margin-top: 0.35rem;
}

.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.65rem 0.3rem 0.3rem;
  border: 0;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.2;
  max-width: min(100%, 16rem);
  color: var(--cui-primary);
}

.user-menu-toggle:hover,
.user-menu-toggle:focus,
.user-menu-toggle.show {
  background: var(--cui-primary);
  color: #fff;
  filter: brightness(0.95);
}

.user-menu-toggle.dropdown-toggle::after {
  margin-inline-start: 0.15rem;
  border-top-color: var(--cui-primary);
  opacity: 0.9;
}

.user-menu-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ticket-description {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.attachment-dropzone {
  position: relative;
  margin: 0;
  border: 1px dashed var(--cui-border-color);
  border-radius: 0.75rem;
  background: rgba(var(--cui-light-rgb), 0.55);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.attachment-dropzone:hover,
.attachment-dropzone.is-dragging {
  border-color: var(--cui-primary);
  background: rgba(var(--cui-primary-rgb), 0.06);
}

.attachment-dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.attachment-dropzone-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
}

.attachment-dropzone-icon {
  font-size: 1.75rem;
  line-height: 1;
  color: var(--cui-secondary-color);
}

.attachment-dropzone-title {
  font-weight: 500;
  color: var(--cui-body-color);
}

.attachment-dropzone-hint {
  font-size: 0.8125rem;
  color: var(--cui-secondary-color);
}

.attachment-dropzone-busy {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: rgba(var(--cui-body-bg-rgb), 0.82);
  font-size: 0.9375rem;
  font-weight: 500;
}

.attachment-dropzone-selected {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  text-align: center;
}

.attachment-dropzone-selected-name {
  font-weight: 500;
  word-break: break-word;
}

.attachment-dropzone.htmx-request .attachment-dropzone-busy {
  display: flex;
}

#ticket-page .btn-spinner.htmx-indicator,
#ticket-page .comment-action-danger .btn-spinner.htmx-indicator {
  display: none;
  width: 1rem;
  height: 1rem;
  margin-right: 0.4rem;
  vertical-align: -0.15em;
  opacity: 1;
}

#ticket-page .htmx-request .btn-spinner.htmx-indicator,
#ticket-page .htmx-request.btn-spinner.htmx-indicator {
  display: inline-block;
}

.attachment-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--cui-border-color);
}

.attachment-list-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.attachment-list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}

.comment-feed {
  padding-top: 0.75rem !important;
}

.comment-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.comment-avatar {
  margin-top: 0.15rem;
  background: var(--cui-primary);
  color: #fff;
}

.comment-main {
  min-width: 0;
  flex: 1;
}

.comment-bubble {
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  background: rgba(var(--cui-light-rgb), 0.95);
  border: 1px solid var(--cui-border-color);
}

.comment-item-internal .comment-bubble {
  background: rgba(var(--cui-warning-rgb), 0.1);
  border-color: rgba(var(--cui-warning-rgb), 0.35);
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.3rem;
}

.comment-author {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cui-body-color);
}

.comment-internal-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--cui-warning-text-emphasis, #997404);
}

.comment-time {
  font-size: 0.75rem;
  color: var(--cui-secondary-color);
}

.comment-time::before {
  content: "·";
  margin-right: 0.45rem;
  color: var(--cui-secondary-color);
}

.comment-body {
  font-size: 0.9375rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.comment-body > *:last-child {
  margin-bottom: 0;
}

.comment-attachments {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  font-size: 0.8125rem;
}

.comment-attachments li + li {
  margin-top: 0.2rem;
}

.comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
  margin-left: 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.comment-actions a,
.comment-actions button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--cui-secondary-color);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
}

.comment-actions a:hover,
.comment-actions button:hover {
  color: var(--cui-primary);
  text-decoration: underline;
}

.comment-action-sep {
  color: var(--cui-secondary-color);
}

.comment-action-danger:hover {
  color: var(--cui-danger) !important;
}

.forum-reply-input {
  min-height: 10rem;
}

.tz-badge {
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: 0.1em;
}

#app-toast-host {
  position: fixed !important;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20000;
  width: max-content;
  max-width: min(28rem, calc(100vw - 1.5rem));
  pointer-events: none;
}

#app-toast-host .toast {
  pointer-events: auto;
  display: block;
  opacity: 1;
  width: auto;
  min-width: 16rem;
  max-width: min(28rem, calc(100vw - 1.5rem));
}

#app-toast-host .toast.show {
  display: block;
  opacity: 1;
}

.ticket-create-selected {
  padding: 1rem 0 1.25rem;
  border-bottom: 1px solid var(--cui-border-color);
}

.ticket-create-selected-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.ticket-create-selected-name {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--cui-body-color);
}

.ticket-create-selected-desc {
  margin-top: 0.35rem;
  max-width: 40rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--cui-secondary-color);
  overflow-wrap: anywhere;
}

.ticket-create-selected .btn-link {
  color: var(--cui-primary);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.ticket-create-selected .btn-link:hover {
  text-decoration: underline;
}

.ticket-create-code {
  max-width: 10rem;
  letter-spacing: 0.2em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ticket-create-verified {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.footer {
  background-color: var(--cui-white);
}

.card, .list-group {
    border-color: var(--cui-border-color) !important;
    box-shadow: var(--cui-box-shadow-sm) !important;
    border-radius: 0.85rem;
    overflow: hidden;
}
.card-body {
    padding: 1.5rem !important;
}
.card-header {
    padding: 1.25rem !important;
    border-bottom: 0 !important;
}
.form-label {
    --cui-text-opacity: 1;
    color: var(--cui-secondary-color) !important;
    font-size: .875em;
}
.nav-underline .nav-link.active, .nav-underline .show>.nav-link {
    font-weight: var(--cui-nav-link-font-weight);
}

/* DataTables Bootstrap 5 — keep controls tidy inside cards */
.card-body .dt-container .dt-layout-row:first-child {
  margin-top: 0;
}

.card-body .dt-container .table {
  margin-bottom: 0;
}