:root {
  --emed-accent: #2563eb;
  --emed-accent-strong: #1d4ed8;
  --emed-surface: rgba(255, 255, 255, 0.78);
  --emed-border: rgba(15, 23, 42, 0.08);
  --emed-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --emed-radius: 22px;
}

body {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 24%),
    linear-gradient(180deg, #f7fbff 0%, #eef4fb 100%);
}

body.dark-mode {
  --emed-surface: rgba(17, 24, 39, 0.82);
  --emed-border: rgba(148, 163, 184, 0.18);
  --emed-shadow: 0 20px 48px rgba(2, 6, 23, 0.35);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(6, 182, 212, 0.16), transparent 22%),
    linear-gradient(180deg, #08111f 0%, #0f172a 100%);
}

.page-header {
  margin: 1.25rem 0 1.5rem;
}

.emed-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.emed-kicker {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--emed-accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.emed-page-title,
.page-title {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.card,
.emed-card {
  border: 1px solid var(--emed-border);
  border-radius: var(--emed-radius);
  box-shadow: var(--emed-shadow);
  backdrop-filter: blur(12px);
  background: var(--emed-surface);
}

.card-header {
  border-bottom-color: var(--emed-border);
}

.form-control,
.form-select,
.input-group > .form-control,
.input-group > .form-select {
  min-height: 46px;
  max-width: 100%;
}

textarea.form-control {
  min-height: 110px;
}

.btn {
  white-space: normal;
  word-break: break-word;
}

.input-group {
  flex-wrap: nowrap;
}

.input-group > .btn {
  flex-shrink: 0;
}

.emed-sidebar-summary {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 2rem;
  padding: 1rem;
  border: 1px solid var(--emed-border);
  border-radius: 18px;
  background: rgba(37, 99, 235, 0.06);
}

.app-sidebar {
  display: flex;
  flex-direction: column;
}

.main-sidemenu {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: calc(100vh - 74px);
}

.side-menu {
  flex: 1;
}

.emed-notifications {
  width: min(420px, calc(100vw - 2rem));
}

.emed-panel {
  border: 1px solid var(--emed-border);
  border-radius: 18px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.5);
}

.emed-management-grid .card {
  height: 100%;
}

.emed-step-card {
  position: sticky;
  top: 92px;
}

.emed-step-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
}

.emed-step-item + .emed-step-item {
  border-top: 1px solid var(--emed-border);
}

.emed-step-item.is-active .emed-step-index {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
}

.emed-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--emed-accent-strong);
  font-weight: 700;
}

.emed-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.emed-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.emed-table-compact td,
.emed-table-compact th {
  vertical-align: middle;
}

.emed-form-stack .form-label {
  font-weight: 600;
}

.emed-helper {
  color: #64748b;
  font-size: 0.875rem;
}

body.dark-mode .emed-panel {
  background: rgba(15, 23, 42, 0.45);
}

.emed-stat-card .avatar {
  width: 3rem;
  height: 3rem;
}

.avatar-border {
  border: solid 1px;
  background-color: #e1e1e1;
}
.emed-table-wrap {
  overflow-x: auto;
}

.emed-table-wrap table {
  min-width: 980px;
}

.ticket-row-link {
  color: inherit;
  font-weight: 600;
}

.ticket-row-link:hover {
  color: var(--emed-accent-strong);
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.ticket-meta strong {
  color: inherit;
}

.ticket-description {
  white-space: pre-wrap;
  line-height: 1.65;
}

.main-chat-footer {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 1rem;
  border-top: 1px solid var(--emed-border);
}

.main-content-body-chat {
  display: flex;
  flex-direction: column;
  min-height: 680px;
}

#ChatBody {
  flex: 1 1 auto;
  min-height: 420px;
  max-height: 620px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem 1.5rem 0.75rem;
  background: #fff;
}

#ChatBody .content-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 0;
}

#ChatBody .media {
  margin-bottom: 0;
}

#ChatBody::-webkit-scrollbar {
  width: 8px;
}

#ChatBody::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.6);
}

#ChatBody .main-chat-time {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem 0;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#ChatBody .main-chat-time::before,
#ChatBody .main-chat-time::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: rgba(148, 163, 184, 0.3);
}

#ChatBody .main-chat-time span {
  padding: 0 1rem;
  background: #fff;
}

.main-content-body-chat .main-chat-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.main-content-body-chat .main-chat-header h6 {
  margin-bottom: 0.2rem;
  font-size: 1.2rem;
}

#comment-list .media {
  align-items: flex-end;
  gap: 1rem;
}

#comment-list .main-img-user {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
}

#comment-list .media-body {
  max-width: calc(100% - 84px);
}

#comment-list .main-msg-wrapper {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.9rem 1rem;
  border-radius: 1.25rem;
  background: #e8ebf3;
  color: #172554;
  line-height: 1.6;
  box-shadow: none;
}

#comment-list .chat-right .main-msg-wrapper {
  background: #d9d4ff;
  border-top-right-radius: 0.6rem;
}

#comment-list .chat-left .main-msg-wrapper {
  border-top-left-radius: 0.6rem;
}

#comment-list .chat-right .media-body {
  text-align: right;
}

#comment-list .chat-right .text-muted {
  justify-content: flex-end;
}

#comment-list .chat-left .text-muted {
  justify-content: flex-start;
}

#comment-list .text-muted.fs-12 {
  gap: 0.55rem !important;
  color: #64748b !important;
  font-size: 0.8rem !important;
}

#comment-list .main-msg-wrapper a {
  color: inherit;
}

#comment-form-wrapper {
  padding: 0.75rem 1.5rem 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  background: #fff;
}

#comment-form-wrapper .main-chat-footer {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.main-chat-footer input[type="file"] {
  display: none;
}

.main-chat-footer textarea.form-control {
  min-height: 48px;
  max-height: 130px;
  resize: none;
  flex: 1;
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
  color: inherit;
  padding: 0.85rem 1rem;
}

.main-chat-footer textarea.form-control::placeholder {
  color: #64748b;
}

.emed-drop-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* width: 2.75rem;
  height: 2.75rem; */
  /* border-radius: 999px; */
  /* border: 1px solid rgba(148, 163, 184, 0.35); */
  color: #64748b;
  background: #fff;
  cursor: pointer;
  font-size: xx-large;
}

#comment-form .btn.btn-icon.btn-primary {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #7765ff, #6b4eff);
  box-shadow: 0 10px 24px rgba(107, 78, 255, 0.28);
}

#comment-form .btn.btn-icon.btn-primary:hover {
  background: linear-gradient(135deg, #8576ff, #755cff);
}

.dropzone-list {
  position: absolute;
  right: 0;
  bottom: calc(100% - 10em);
  width: 100%;
  padding: 0.65rem 0.75rem;
  height: 100%;
  /* border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.12); */
}

body.dark-mode #comment-form-wrapper .main-chat-footer {
  background: transparent;
}

body.dark-mode .main-chat-footer textarea.form-control {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(30, 41, 59, 0.86);
  color: #e2e8f0;
}

body.dark-mode .main-chat-footer textarea.form-control::placeholder {
  color: #94a3b8;
}

body.dark-mode #ChatBody,
body.dark-mode #comment-form-wrapper {
  background: rgba(15, 23, 42, 0.38);
}

body.dark-mode #ChatBody .main-chat-time span {
  background: rgba(15, 23, 42, 0.38);
}

body.dark-mode #comment-list .main-msg-wrapper {
  background: rgba(26, 57, 107, 0.92);
  color: #e2e8f0;
}

body.dark-mode #comment-list .chat-right .main-msg-wrapper {
  background: rgba(26, 57, 107, 0.92);
}

body.dark-mode .emed-drop-trigger,
body.dark-mode .dropzone-list {
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
}

.comment-pinned .main-msg-wrapper {
  background: rgba(251, 191, 36, 0.14);
  border: 1px dashed rgba(217, 119, 6, 0.5);
}

body.dark-mode .comment-pinned .main-msg-wrapper,
body.dark-mode .comment-pinned .main-msg-wrapper a {
  color: inherit;
}

.ticket-has-comments td:first-child {
  position: relative;
}

.ticket-has-comments td:first-child::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #0ea5e9;
}

.emed-empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: #64748b;
}

.emed-login-card {
  overflow: hidden;
}

.emed-login-card::before {
  content: "";
  display: block;
  height: 6px;
  background: linear-gradient(90deg, #2563eb, #06b6d4, #22c55e);
}

.auth-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.22), transparent 22%),
    radial-gradient(circle at 90% 15%, rgba(96, 165, 250, 0.22), transparent 24%),
    radial-gradient(circle at 20% 85%, rgba(14, 165, 233, 0.18), transparent 20%),
    linear-gradient(135deg, #f3fbff 0%, #e0f2fe 35%, #dbeafe 100%);
  background-size: 120% 120%;
  animation: authGradientShift 16s ease-in-out infinite;
}

.auth-page {
  min-height: calc(100vh - 2rem);
  display: flex;
  align-items: center;
}

.auth-brand-panel {
  padding: 1.5rem;
  border: 1px solid var(--emed-border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.04));
}

@keyframes authGradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

#global-loader {
  transition: opacity 0.18s ease;
}

.emed-ws-status {
  font-size: 0.8rem;
  color: #64748b;
}

.registration-wizard .content {
  min-height: 0;
  padding-top: 1.5rem;
}

.registration-wizard .steps {
  margin-bottom: 1rem;
}

.registration-wizard .steps ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.registration-wizard .steps li {
  width: 100%;
}

.registration-wizard .steps a {
  border-radius: 18px;
}

.registration-wizard-summary dt {
  color: #64748b;
}

.registration-wizard-summary dd {
  font-weight: 600;
}

.executor-load-toggle {
  color: inherit;
}

.executor-load-toggle:hover {
  color: inherit;
}

.executor-load-toggle__meta {
  display: inline-flex;
  align-items: center;
}

.executor-load-toggle__icon {
  transition: transform 0.28s ease;
}

.executor-load-toggle[aria-expanded="true"] .executor-load-toggle__icon {
  transform: rotate(180deg);
}

.executor-load-panel {
  transition: height 0.3s ease;
}

.ticket-pagination .page-link {
  border-radius: 10px;
}

.ticket-status-badge {
  border-radius: 999px;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
}

.ticket-status-badge--new {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
}

.ticket-status-badge--in_progress {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.ticket-status-badge--waiting {
  background: rgba(168, 85, 247, 0.14);
  color: #7e22ce;
}

.ticket-status-badge--resolved {
  background: rgba(34, 197, 94, 0.16);
  color: #15803d;
}

.ticket-status-badge--closed {
  background: rgba(100, 116, 139, 0.16);
  color: #475569;
}

.ticket-row-new {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.02));
}

.ticket-row-new td:first-child {
  box-shadow: inset 4px 0 0 #2563eb;
}

.ticket-side-stack {
  display: grid;
  gap: 1rem;
}

.emed-confirm-card .card-body {
  padding: 2rem;
}

.emed-confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1rem;
  border-radius: 18px;
  background: rgba(239, 68, 68, 0.12);
  font-size: 1.4rem;
}

.emed-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.emed-soft-note {
  padding: 0.85rem 1rem;
  border: 1px solid var(--emed-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
}

.ticket-participant-list,
.ticket-help-history {
  display: grid;
  gap: 0.85rem;
}

.ticket-participant-item,
.ticket-help-history__item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--emed-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
}

.ticket-help-history__item {
  display: block;
}

.ticket-description {
  white-space: pre-wrap;
  line-height: 1.6;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

body.dark-mode .ticket-participant-item,
body.dark-mode .ticket-help-history__item {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.18);
}

body.dark-mode .emed-soft-note {
  background: rgba(15, 23, 42, 0.55);
}

@media (max-width: 991.98px) {
  .page-header {
    margin-top: 0.75rem;
  }

  .emed-page-header,
  .emed-card-title-row,
  .emed-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .emed-step-card {
    position: static;
  }

  .main-chat-footer {
    flex-wrap: wrap;
  }

  .main-chat-footer textarea.form-control {
    width: 100%;
  }

  .registration-wizard .steps ul {
    grid-template-columns: 1fr;
  }

  .input-group {
    flex-wrap: wrap;
  }

  .input-group > .btn,
  .input-group > .form-control,
  .input-group > .form-select {
    width: 100%;
  }
}

body.dark-mode,
body.dark-mode .page,
body.dark-mode .main-content,
body.dark-mode .card,
body.dark-mode .dropdown-menu,
body.dark-mode .modal-content,
body.dark-mode .offcanvas,
body.dark-mode .list-group-item,
body.dark-mode .table,
body.dark-mode .text-dark {
  color: #f8fbff !important;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode .page-title,
body.dark-mode .card-title,
body.dark-mode .side-menu__label,
body.dark-mode .nav-link,
body.dark-mode .dropdown-item,
body.dark-mode label,
body.dark-mode .form-label,
body.dark-mode .col-form-label,
body.dark-mode .table th,
body.dark-mode .table td,
body.dark-mode .main-profile-menu .dropdown-item,
body.dark-mode .header-navheading,
body.dark-mode .notification-label,
body.dark-mode .main-notification-text,
body.dark-mode .main-notification-time,
body.dark-mode .main-header-center .form-control {
  color: #f8fbff !important;
}

body.dark-mode p,
body.dark-mode small,
body.dark-mode span,
body.dark-mode li,
body.dark-mode .text-muted,
body.dark-mode .tx-muted,
body.dark-mode .text-secondary,
body.dark-mode .ticket-meta,
body.dark-mode .empty-state-text,
body.dark-mode .page-header .breadcrumb-item,
body.dark-mode .form-text,
body.dark-mode .registration-wizard-summary dt,
body.dark-mode .executor-load-toggle__meta,
body.dark-mode .main-mail-msg,
body.dark-mode .chat-msg-append,
body.dark-mode .chat-time,
body.dark-mode .main-notification-subtext {
  color: #dbeafe !important;
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select,
body.dark-mode .form-control,
body.dark-mode .form-select {
  color: #f8fbff !important;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder,
body.dark-mode .form-control::placeholder {
  color: #cbd5e1 !important;
  opacity: 1;
}

body.dark-mode .btn-light,
body.dark-mode .btn-outline-light,
body.dark-mode .badge.bg-light,
body.dark-mode .badge.text-dark {
  color: #f8fbff !important;
}

body.dark-mode a:not(.btn):not(.ticket-status-badge) {
  color: #e0f2fe;
}

body.dark-mode a:not(.btn):not(.ticket-status-badge):hover {
  color: #ffffff;
}
