body,
html {
  height: 100%;
}

#wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
}

#page-content-wrapper {
  flex-grow: 1;
  width: 100%;
  margin-left: 250px;
  overflow: auto;
}

#sidebar-wrapper {
    width: 250px; 
  height: 100vh;
  /* overflow-y: auto; */
  position: fixed; /* Fixed position */

}

#sidebar-wrapper.collapsed {
  width: 80px !important;
  z-index: 1050;
}

#page-content-wrapper.expanded {
  margin-left: 80px; /* Ensure this matches the collapsed sidebar width */
}

/* Adjust the size of the icons and the display of text in collapsed mode */
#sidebar-wrapper.collapsed .nav-link span,
#sidebar-wrapper.collapsed .sidebar-heading h2 {
  display: none;
}

#sidebar-wrapper.collapsed .bi-list {
  display: inline-block;
}

/* Sidebar styling */
#sidebar-wrapper {
  transition: width 0.3s ease;
}

#page-content-wrapper {
  transition: margin-left 0.3s ease;
}

.table-container {
  overflow: visible;
}

#sidebar-wrapper.collapsed ul li a span,
#sidebar-wrapper.collapsed ul li a i {
  display: none;
  /* Hide text labels */
}

#sidebar-wrapper.collapsed ul li a i {
  display: inline-block;
  /* Ensure icons are shown */
}

#sidebar-wrapper ul li ul li a {
  background-color: #4b4f54;
  /* Slightly lighter than the main sidebar color */
}

#sidebar-wrapper ul li a:hover,

#sidebar-wrapper ul li ul li a:hover {
  background-color: #1c1e22;
  /* A bit lighter for hover effect */
}

#sidebar-wrapper.collapsed ul {
  list-style-type: none;
  /* Remove bullets */
  padding-left: 0;
  /* Remove padding that may offset icons to the right */
}

#sidebar-wrapper ul {
  list-style-type: none;
  /* Consistently remove bullets */
  padding-left: 0;
  /* Consistently remove padding */
}


.nav-link i,
.dropdown-toggle i {
    font-size: 16px; /* Standard icon size */
}


.nav-link {
    color: whitesmoke;
}


.table-container {
    overflow: visible; 
  }

/* Ensure Bootstrap modals stay above backdrop and custom menus */
.modal {
  z-index: 2000 !important;
}

.modal-backdrop {
  z-index: 1990 !important;
}

.modal-dialog {
  pointer-events: auto;
}

.custom-select2+.select2-container {
    min-width: 180px;
}

.word-wrap {
    word-wrap: break-word;
    max-width: 600px;
}

.select2-container {
  width: 100% !important;
  min-width: 250px !important;
  max-width: 600;
}

.select2-selection--multiple {
  min-height: 38px;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
}

.select2-selection__rendered {
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  white-space: normal;
  max-width: 100%;
  position: relative;
}

.select2-selection__choice {
  margin-top: 0.2rem;
  margin-right: 0.2rem;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  flex: 0 1 auto;
}

td .select2-container {
  min-width: 350px !important;
  max-width:600px;
  width: 100% !important;
  display: inline-block;
}


.select2-search__field {
  width: auto !important;
  min-width: 1em !important;
  max-width: 300px !important;
  flex-grow: 1;
  flex-shrink: 1;
}

.select2-selection__choice.hidden-choice {
  display: none;
}

.select2-selection__choice.more-indicator {
  display: inline-block;
  background-color: #e2e6ea;
  color: #333;
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.select2-selection__rendered {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  max-width: 100%;
}

.select2-selection--multiple {
  max-width: 100%;
  overflow-x: auto;
}

.select2-selection__choice {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Instruction generator dropzone */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  background: #f8fafc;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  position: relative;
}

.dropzone-link {
  position: relative;
  z-index: 2;
}

.dropzone.is-dragover {
  border-color: #4f46e5;
  background: #eef2ff;
}

.dropzone-body {
  text-align: center;
}

.dropzone-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.dropzone-title {
  font-weight: 600;
  color: #0f172a;
}

.dropzone-subtitle {
  color: #475569;
  margin-top: 4px;
}

.dropzone-link {
  color: #4f46e5;
  text-decoration: underline;
}

.dropzone-meta {
  font-size: 0.85rem;
  margin-top: 6px;
}

.file-preview {
  min-height: 32px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: #0f172a;
}

.file-chip-size {
  color: #64748b;
}

.file-input-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: auto;
  border: 0;
}

/* Instructions refresh */
.instructions-shell {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: #0f172a;
}

.instructions-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(120deg, #fef3c7 0%, #fef9c3 40%, #e0f2fe 100%);
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  margin: 24px 0;
}

.instructions-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  font-weight: 600;
  color: #a16207;
}

.instructions-title {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 2rem;
  margin: 6px 0 4px;
}

.instructions-subtitle {
  margin: 0;
  color: #475569;
  max-width: 520px;
}

.instructions-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.instructions-panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}

.instructions-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.panel-title {
  font-weight: 600;
}

.panel-hint {
  font-size: 0.85rem;
  color: #64748b;
}

.filters-panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}

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

.filters-form .filters-label {
  margin-bottom: 4px;
  font-size: 0.85rem;
  color: #64748b;
}

.filters-panel .form-label,
.filters-panel .col-form-label {
  margin-bottom: 4px;
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 400;
}

.filters-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filters-advanced {
  border-top: 1px solid #eef2f7;
  padding-top: 10px;
}

.instructions-table-card {
  margin-top: 24px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 12px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
}

.instruction-table thead th {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  color: #475569;
}

.instruction-table tbody tr:hover {
  background: #f8fafc;
}

.instruction-table .badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 500;
}

.instruction-name-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.instruction-name {
  font-weight: 600;
  font-size: 1rem;
}

.instruction-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge-pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-outline {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #475569;
}

.badge-success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-warning {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-muted {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.composition-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: #475569;
}

.composition-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composition-icon {
  font-size: 1rem;
}

.composition-value {
  margin-left: auto;
  font-weight: 600;
  color: #0f172a;
}

.tag-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-tag {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.badge-theme {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0369a1;
}

.badge-sentiment {
  background: #fce7f3;
  border-color: #fbcfe8;
  color: #9d174d;
}

.badge-author {
  background: #ede9fe;
  border-color: #ddd6fe;
  color: #5b21b6;
}

@media (max-width: 992px) {
  .instructions-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .instructions-cta {
    justify-content: flex-start;
  }
}

/* Settings refresh */
.settings-shell {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: #0f172a;
}

.settings-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(120deg, #e0f2fe 0%, #fef3c7 55%, #fee2e2 100%);
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  margin: 24px 0;
}

.settings-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  font-weight: 600;
  color: #0ea5e9;
}

.settings-title {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 2rem;
  margin: 6px 0 4px;
}

.settings-subtitle {
  margin: 0;
  color: #475569;
  max-width: 520px;
}

.settings-card {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.settings-card-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.settings-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.settings-card-content h5 {
  margin: 0 0 4px;
  font-weight: 600;
}

.settings-card-content p {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
}

/* Sessions refresh */
.sessions-shell {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: #0f172a;
}

.sessions-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(120deg, #f1f5f9 0%, #dbeafe 45%, #e0f2fe 100%);
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  margin: 24px 0;
}

.sessions-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  font-weight: 600;
  color: #2563eb;
}

.sessions-title {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 2rem;
  margin: 6px 0 4px;
}

.sessions-subtitle {
  margin: 0;
  color: #475569;
  max-width: 520px;
}

.sessions-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.sessions-panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}

.sessions-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sessions-table-card {
  margin-top: 24px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 12px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
}

.sessions-table {
  border-radius: 12px;
  overflow: hidden;
}

@media (max-width: 992px) {
  .settings-hero,
  .sessions-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .sessions-cta {
    justify-content: flex-start;
  }
}

/* Shared section layout for refreshed pages */
.section-shell {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: #0f172a;
}

.section-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(120deg, #f8fafc 0%, #e0f2fe 50%, #e2e8f0 100%);
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  margin: 24px 0;
}

.section-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  font-weight: 600;
  color: #2563eb;
}

.section-title {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 2rem;
  margin: 6px 0 4px;
}

.section-subtitle {
  margin: 0;
  color: #475569;
  max-width: 520px;
}

.section-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.panel-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}

.table-card {
  margin-top: 24px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 12px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
}

.form-card {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  padding: 24px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
}

.form-card .form-label {
  font-weight: 600;
  color: #0f172a;
}

.form-card .form-text {
  color: #64748b;
}

.form-control,
.form-select,
.form-check-input,
.select2-selection {
  border-radius: 12px;
  border-color: #e2e8f0;
  box-shadow: none;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 0.2rem rgba(147, 197, 253, 0.25);
}

.modal-content {
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.12);
}

.modal-header {
  border-bottom: 1px solid #e2e8f0;
}

.modal-footer {
  border-top: 1px solid #e2e8f0;
}

.progress {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}

.progress-bar {
  background: linear-gradient(90deg, #3b82f6 0%, #6366f1 100%);
}

/* Hide default darkmode-js floating widget; theme is controlled via account menu toggle. */
.darkmode-toggle,
.darkmode-toggle--active,
.darkmode-toggle--inactive {
  display: none !important;
}

/* Monitoring feeds workspace */
.monitoring-feeds-shell {
  padding-bottom: 24px;
}

.monitoring-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.monitoring-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.monitoring-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid #dbe4f0;
  background: #f8fafc;
  color: #334155;
  font-size: 0.78rem;
}

.monitoring-chip-link {
  text-decoration: none;
  transition: all 0.15s ease;
}

.monitoring-chip-link:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.monitoring-chip-link.is-active {
  background: #e0efff;
  color: #1d4ed8;
  border-color: #bfdcff;
  font-weight: 600;
}

.monitoring-filter-panel {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
  padding: 12px;
  margin-bottom: 14px;
}

.monitoring-filter-form {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) auto;
  gap: 10px;
  align-items: end;
}

.monitoring-filter-form .form-label {
  margin-bottom: 4px;
  font-size: 0.82rem;
  color: #64748b;
}

.monitoring-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.monitoring-feed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.monitoring-feed-card {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  min-height: 188px;
}

.monitoring-feed-card-system {
  border-color: #bfdbfe;
  background: linear-gradient(145deg, #f8fbff 0%, #eef6ff 100%);
}

.monitoring-feed-card-add {
  border: 2px dashed #93c5fd;
  background: linear-gradient(145deg, #f8fbff 0%, #eff6ff 100%);
}

.monitoring-feed-card-add .monitoring-feed-title {
  color: #1d4ed8;
}

.monitoring-feed-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.monitoring-feed-title {
  margin: 0;
  font-size: 1.03rem;
  color: #0f172a;
}

.monitoring-feed-brand {
  margin-top: 3px;
  font-size: 0.82rem;
  color: #64748b;
}

.monitoring-feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: #475569;
  font-size: 0.8rem;
}

.monitoring-feed-meta strong {
  color: #0f172a;
}

.monitoring-feed-alert {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  padding: 8px 10px;
  font-size: 0.78rem;
}

.monitoring-feed-actions {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.monitoring-inline-form {
  display: inline;
}

.monitoring-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: linear-gradient(120deg, #f8fafc 0%, #eef6ff 50%, #f8fafc 100%);
  padding: 30px;
  text-align: center;
}

.monitoring-empty-title {
  margin: 0;
  font-size: 1.35rem;
  color: #0f172a;
}

.monitoring-empty-subtitle {
  margin: 10px auto 0;
  max-width: 640px;
  color: #475569;
}

.monitoring-empty-actions {
  margin-top: 16px;
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Wizard layout */
.wizard-shell {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: #0f172a;
}

.wizard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(120deg, #f8fafc 0%, #e2e8f0 45%, #e0f2fe 100%);
  border-radius: 20px;
  padding: 24px 32px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  margin: 24px 0;
}

.wizard-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  font-weight: 600;
  color: #2563eb;
}

.wizard-title {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1.9rem;
  margin: 6px 0 4px;
}

.wizard-subtitle {
  margin: 0;
  color: #475569;
  max-width: 560px;
}

.wizard-steps {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-size: 0.8rem;
  color: #475569;
}

.wizard-step.is-active {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1d4ed8;
  font-weight: 600;
}

.wizard-step.is-done {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #15803d;
}

.step-context {
  padding: 2px 0 8px;
  border-bottom: 1px solid #e2e8f0;
}

.step-context-title {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.step-context-subtitle {
  margin-top: 2px;
  font-size: 0.85rem;
  color: #64748b;
}

.detected-preview-list {
  display: grid;
  gap: 8px;
}

.detected-preview-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 8px 10px;
}

.detected-preview-kv {
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.35;
}

.detected-preview-key {
  font-weight: 600;
  color: #334155;
}

.detected-preview-val {
  color: #334155;
}

.mapping-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mapping-info-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px;
}

.mapping-info-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
}

.mapping-info-subtitle {
  margin-top: 2px;
  font-size: 0.8rem;
  color: #64748b;
}

.mapping-info-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.messages-row-action-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.messages-actions-col {
  width: 88px;
}

.messages-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 20px 0 14px;
}

.messages-page-kicker {
  font-size: 0.72rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.messages-page-title {
  margin: 2px 0 0;
  font-size: 1.5rem;
  color: #0f172a;
}

.messages-page-subtitle {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.4;
  max-width: 640px;
}

.messages-page-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.messages-filters-panel {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.messages-filters-panel-header {
  padding: 0 0 10px;
}

.messages-filters-form {
  padding: 0;
}

.messages-filter-quick {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(0, 0.8fr)) minmax(0, 0.9fr) auto;
  gap: 10px;
  align-items: end;
}

.messages-filter-item .form-label {
  margin-bottom: 4px;
  font-size: 0.85rem;
  color: #64748b;
}

.messages-filter-item input,
.messages-filter-item select {
  border-radius: 10px;
}

.messages-filter-item-search input {
  min-width: 240px;
}

.messages-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.messages-filter-actions .btn {
  height: 38px;
  border-radius: 10px;
  padding-left: 14px;
  padding-right: 14px;
}

.messages-filter-item-preset {
  align-self: end;
}

.messages-preset-dropdown {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.messages-preset-trigger {
  border: 0;
  background: transparent;
  color: #334155;
  font-size: 0.85rem;
  line-height: 1.3;
  padding: 0;
  border-bottom: 1px dashed #94a3b8;
  cursor: pointer;
}

.messages-preset-trigger:hover {
  color: #0f172a;
  border-bottom-color: #64748b;
}

.messages-preset-trigger:focus-visible {
  outline: 2px solid #7da6f7;
  outline-offset: 2px;
  border-radius: 2px;
}

.messages-preset-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 190px;
  border: 1px solid #dbe2ee;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  padding: 6px;
  display: none;
  z-index: 40;
}

.messages-preset-menu.is-open {
  display: block;
}

.messages-preset-option {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1e293b;
  font-size: 0.83rem;
  text-align: left;
  padding: 7px 9px;
}

.messages-preset-option:hover {
  background: #f1f5f9;
}

.messages-icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.messages-icon-btn i {
  font-size: 1rem;
}

.messages-advanced-filters {
  border-top: 1px solid #eef2f7;
  padding-top: 10px;
}

.messages-advanced-filters summary {
  cursor: pointer;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
}

.messages-advanced-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.messages-workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.messages-feed-shell {
  min-width: 0;
}

.messages-selection-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.messages-selection-bar .form-check span {
  font-size: 0.84rem;
  font-weight: 600;
  color: #0f172a;
}

.messages-clear-btn {
  font-size: 0.78rem;
  color: #64748b;
  text-decoration: none;
}

.messages-clear-btn:hover {
  color: #334155;
}

.messages-feed-stats {
  display: flex;
  gap: 10px;
  color: #475569;
  font-size: 0.84rem;
}

.messages-feed-stats strong {
  color: #0f172a;
}

.messages-card-list {
  display: grid;
  gap: 10px;
}

.messages-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fdfefe;
  padding: 11px 12px;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.messages-card:hover {
  border-color: #cfd8e6;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.messages-card.is-selected {
  border-color: #93c5fd;
  background: #f0f7ff;
}

.messages-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.messages-card-head-main {
  display: flex;
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.messages-card-date {
  font-size: 0.79rem;
  color: #1e293b;
  font-weight: 600;
}

.messages-card-meta-line {
  margin-top: 3px;
  font-size: 0.76rem;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.messages-card-meta-line span::after {
  content: "•";
  margin-left: 8px;
  color: #cbd5e1;
}

.messages-card-meta-line span:last-child::after {
  content: "";
  margin: 0;
}

.messages-card-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eef2f7;
}

.messages-card-text {
  margin: 0;
  color: #0f172a;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.messages-card-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.82rem;
  text-decoration: none;
}

.messages-card-link:hover {
  text-decoration: underline;
}

.messages-pagination {
  margin-top: 12px;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.messages-pagination-left {
  display: flex;
  align-items: center;
}

.messages-page-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.messages-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #d1dbe9;
  background: #ffffff;
  color: #334155;
  text-decoration: none;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0 10px;
}

.messages-page-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
}

.messages-page-btn.is-active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.messages-page-btn.is-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

.messages-pagination-meta {
  color: #64748b;
  font-size: 0.82rem;
}

.messages-side-panel {
  position: sticky;
  top: 88px;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  padding: 14px;
}

.messages-side-kicker {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 700;
}

.messages-side-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.messages-side-panel .btn {
  border-radius: 10px;
}

.messages-side-workspace-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  padding-left: 10px;
  padding-right: 10px;
}

.messages-side-workspace-btn i {
  font-size: 0.95rem;
}

.messages-side-title {
  margin: 4px 0 0;
  font-size: 1rem;
  color: #0f172a;
}

.messages-side-text {
  margin: 6px 0 10px;
  color: #64748b;
  font-size: 0.84rem;
  line-height: 1.4;
}

.messages-side-note {
  margin-top: 10px;
  font-size: 0.8rem;
  color: #64748b;
}

.messages-side-note a {
  color: #475569;
  text-decoration: none;
}

.messages-side-note a:hover {
  color: #1e293b;
  text-decoration: underline;
}

.messages-actions-menu {
  min-width: 260px;
  border-radius: 12px;
  border-color: #d9e3f5;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.messages-actions-menu .dropdown-header {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.messages-actions-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  white-space: normal;
  padding-top: 8px;
  padding-bottom: 8px;
}

.messages-actions-item-icon {
  margin-top: 2px;
  color: #334155;
}

.messages-actions-item-title {
  display: block;
  color: #0f172a;
  font-weight: 600;
  line-height: 1.2;
}

.messages-actions-item-meta {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 0.75rem;
  line-height: 1.3;
}

.messages-scope-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.messages-scope-switch .btn.is-active {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
}

.messages-dataset-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 16px;
}

.messages-dataset-modal-backdrop.is-open {
  display: flex;
}

.messages-dataset-modal {
  width: min(760px, 100%);
  border: 1px solid #d6e2f5;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 26px 54px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.messages-dataset-modal-header,
.messages-dataset-modal-footer {
  border-bottom: 1px solid #e2ebfa;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.messages-dataset-modal-footer {
  border-top: 1px solid #e2e8f0;
  border-bottom: 0;
}

.messages-modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid #d4deef;
  border-radius: 10px;
  background: #ffffff;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.messages-modal-close:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #becde3;
}

.messages-modal-close:focus-visible {
  outline: 2px solid #7da6f7;
  outline-offset: 2px;
}

.messages-dataset-modal-body {
  padding: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.messages-modal-field {
  margin-bottom: 12px;
}

.messages-modal-field:last-of-type {
  margin-bottom: 0;
}

.messages-upload-modal-shell {
  width: min(640px, 100%);
}

.messages-upload-status {
  margin-top: 12px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
}

.messages-upload-status .progress {
  height: 8px;
}

.messages-upload-status-text {
  margin-top: 8px;
  color: #334155;
  font-size: 0.84rem;
}

.messages-upload-status-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.messages-modal-scope-options {
  display: grid;
  gap: 8px;
}

.messages-modal-scope-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dde6f2;
  border-radius: 10px;
  background: #f8fafc;
  padding: 9px 10px;
}

.messages-modal-scope-option .form-check-input {
  margin-top: 0;
}

.messages-modal-summary {
  border: 1px solid #d6e3fb;
  border-radius: 12px;
  background: #f5f9ff;
  padding: 10px 12px;
}

.messages-modal-summary-title {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5a7199;
}

.messages-modal-summary-text {
  margin-top: 4px;
  color: #1b3f78;
  font-size: 0.88rem;
}

.messages-modal-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.messages-current-scope {
  font-size: 0.84rem;
  color: #475569;
}

.messages-current-scope-label {
  color: #64748b;
}

#messages-current-scope-value {
  color: #0f172a;
  font-weight: 600;
}

.messages-dataset-catalog-modal {
  width: min(860px, 100%);
}

.messages-dataset-catalog-list {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.messages-dataset-catalog-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
}

.messages-dataset-catalog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.messages-dataset-catalog-name {
  color: #0f172a;
  font-weight: 600;
}

.messages-dataset-catalog-meta {
  margin-top: 2px;
  color: #64748b;
  font-size: 0.8rem;
}

.source-mode-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.source-mode-card {
  min-height: 92px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.source-mode-card:hover {
  border-color: #60a5fa;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.12);
}

.source-mode-card.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.16);
}

.source-mode-title {
  display: block;
  font-weight: 600;
  color: #1e3a8a;
}

.source-mode-subtitle {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #475569;
}

.dataset-browser {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  padding: 10px;
}

.dataset-browser-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.dataset-kind-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dataset-kind-filters .btn {
  min-height: 40px;
}

.dataset-kind-filters .btn.is-active {
  background: #1e40af;
  border-color: #1e40af;
  color: #ffffff;
}

.dataset-catalog-list {
  display: grid;
  gap: 8px;
  max-height: 380px;
  overflow: auto;
  padding-right: 2px;
}

.dataset-catalog-item {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #ffffff;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.dataset-catalog-item:hover {
  border-color: #60a5fa;
  box-shadow: 0 10px 20px rgba(30, 64, 175, 0.12);
}

.dataset-catalog-item.is-selected {
  border-color: #1e40af;
  background: #eff6ff;
  box-shadow: 0 10px 20px rgba(30, 64, 175, 0.16);
}

.dataset-catalog-title-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.dataset-catalog-title {
  font-weight: 600;
  color: #0f172a;
}

.dataset-catalog-meta {
  margin-top: 4px;
  font-size: 0.8rem;
  color: #475569;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-preview {
  margin-top: 10px;
}

.tag-preview .tag {
  display: inline-block;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px 10px;
  margin-right: 6px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: #334155;
}

.wizard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.wizard-grid.no-summary {
  grid-template-columns: minmax(0, 1fr);
}

.wizard-grid.no-summary .wizard-summary {
  display: none;
}

.wizard-summary {
  position: sticky;
  top: 90px;
}

.summary-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 16px 18px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.summary-card h6 {
  font-weight: 600;
  margin-bottom: 12px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 8px;
}

.summary-item strong {
  color: #0f172a;
}

@media (max-width: 992px) {
  .wizard-hero {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .wizard-summary {
    position: static;
  }

  .mapping-info-grid {
    grid-template-columns: 1fr;
  }

  .source-mode-cards {
    grid-template-columns: 1fr;
  }

  .messages-dataset-modal {
    width: 100%;
  }

  .messages-workbench-grid {
    grid-template-columns: 1fr;
  }

  .messages-page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .messages-filter-quick {
    grid-template-columns: 1fr;
  }

  .messages-advanced-grid {
    grid-template-columns: 1fr;
  }

  .messages-side-panel {
    position: static;
    margin-top: 4px;
  }

  .messages-selection-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .messages-pagination {
    flex-wrap: wrap;
  }

  .messages-dataset-catalog-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .monitoring-filter-form {
    grid-template-columns: 1fr;
  }

  .monitoring-filter-actions {
    justify-content: flex-start;
  }

  .monitoring-feed-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 992px) {
  .section-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-cta {
    justify-content: flex-start;
  }
}
