:root {
  /* Primary — resolved from #007bff (Bootstrap default) vs #2e6bff (custom).
     Choosing #2e6bff: it's the intentional custom blue used for chips, focus
     rings, and selection states throughout the app. */
  --color-primary: #2e6bff;
  --color-primary-hover: #1a56e6;
  --color-primary-light: rgba(46, 107, 255, 0.12);
  --color-primary-ring: rgba(46, 107, 255, 0.4);

  --color-bg: #ffffff;
  --color-surface: #f8f9fa;
  --color-text: #111827;
  --color-text-secondary: #6c757d;
  --color-text-muted: #555;

  --color-success: #28a745;
  --color-danger: #dc3545;
  --color-warning: #ffc107;

  /* Gray scale — replaces the six near-identical off-whites (#f8f9fa, #f8fafc,
     #f7f8fa, #f6f8fa, #f5f5f5, #fafbfc) and scattered mid-grays. */
  --gray-50:  #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #adb5bd;
  --gray-500: #6c757d;
  --gray-600: #555555;
  --gray-700: #444444;
  --gray-800: #333333;
  --gray-900: #111827;

  --color-border: #dcdfe3;
  --color-border-light: #e9ecef;

  /* Spacing — 4px base, powers of the grid */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;

  /* Type scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;

  /* Border radius */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-3: 0 8px 24px rgba(0, 0, 0, 0.15);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

.container {
  display: flex;
  min-height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}

.sidebar {
  width: 250px;
  background-color: #f8f9fa;
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.main-content {
  flex-grow: 1;
  padding: 20px;
  font-size: 0.95rem;
  font-weight: 400;
  color: #000;
}

.content-card {
  color: #000;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
}

.content-card .table {
  margin-bottom: 0;
}

.content-card .form-label,
.content-card .form-check-label,
.content-card .form-text,
.content-card .text-muted {
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
}

.content-card .form-control,
.content-card input,
.content-card textarea,
.content-card select {
  color: inherit !important;
  font-size: inherit !important;
  font-family: inherit !important;
  font-weight: inherit !important;
}

.content-card .form-text,
.content-card .text-muted {
  opacity: 1;
}

.content-card ::placeholder {
  color: inherit;
  opacity: 1;
}

.content-card .form-control:disabled,
.content-card input:disabled,
.content-card textarea:disabled,
.content-card select:disabled {
  color: inherit;
  opacity: 1;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar ul li {
  margin-bottom: 10px;
}

.sidebar ul li a {
  text-decoration: none;
  color: #333;
  font-weight: bold;
}

.sidebar ul li a:hover {
  color: #007bff;
}

.sidebar ul ul {
  margin-left: 15px;
  margin-top: 5px;
}

.sidebar ul ul li a {
  font-weight: normal;
  color: #555;
}

.sidebar ul li.selected > a {
  background-color: #e9ecef;
  border-radius: 4px;
  padding: 0;
  color: #000;
  display: block;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ms-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ms-row .ms-control {
  flex: 1 1 auto;
}

.field-with-help {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-with-help.align-start {
  align-items: flex-start;
}

.field-with-help textarea,
.field-with-help .form-control {
  flex: 1 1 auto;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #6c757d;
  color: #6c757d;
  font-size: 12px;
  font-weight: 600;
  cursor: help;
  position: relative;
  flex-shrink: 0;
  background: #fff;
}

.help-icon::before,
.help-icon::after {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.help-icon::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #fff;
  filter: drop-shadow(0 -1px 1px rgba(0, 0, 0, 0.08));
}

.help-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #000;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
  padding: 0.5rem 0.75rem;
  border-radius: 0.35rem;
  width: 260px;
  font-size: 0.85rem;
  line-height: 1.2;
  z-index: 20;
  text-align: left;
}

.help-icon:hover::before,
.help-icon:hover::after,
.help-icon:focus::before,
.help-icon:focus::after {
  opacity: 1;
}

pre {
  background: #f6f8fa;
  padding: 1rem;
  border-radius: 8px;
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.ms {
  max-width: 100%;
}
.ms label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.ms-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid #dcdfe3;
  border-radius: 0.6rem;
  padding: 0.35rem 0.5rem;
  min-height: 2.5rem;
  cursor: text;
  background: #fff;
}
.ms-control:focus-within {
  outline: 2px solid rgba(46, 107, 255, 0.4);
  border-color: #2e6bff;
}
.ms-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(46, 107, 255, 0.12);
  border: 1px solid rgba(46, 107, 255, 0.22);
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  font-size: 0.9rem;
}
.ms-chip button {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0 0.1rem;
  line-height: 1;
  font-size: 1rem;
  color: #444;
}
.ms-input {
  flex: 1 1 180px;
  min-width: 140px;
  border: 0;
  outline: 0;
  font-size: 1rem;
  padding: 0.25rem;
}
.ms-list {
  margin-top: 0.25rem;
  border: 1px solid #dcdfe3;
  border-radius: 0.6rem;
  list-style: none;
  padding: 0.25rem;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
}
.ms-list[hidden] {
  display: none;
}
.ms-option {
  padding: 0.5rem 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ms-option:hover {
  background: rgba(46, 107, 255, 0.08);
}
.ms-option[aria-selected="true"],
.ms-option.active {
  background: rgba(46, 107, 255, 0.18);
}
.ms-option input {
  margin-right: 0.5rem;
}
.ms-option .hint {
  color: #6c757d;
  font-size: 0.85rem;
  margin-left: auto;
}
.ms .help {
  color: #6c757d;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}
.more-filters {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0;
}

.more-filters summary {
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  list-style: none;
  user-select: none;
}

.more-filters summary::-webkit-details-marker {
  display: none;
}

.more-filters summary::before {
  content: '\25B6';
  display: inline-block;
  margin-right: var(--space-2);
  font-size: var(--text-xs);
  transition: transform 0.15s ease;
}

.more-filters[open] summary::before {
  transform: rotate(90deg);
}

.more-filters-body {
  padding: 0 var(--space-4) var(--space-3);
}

mark {
  background: rgba(46, 107, 255, 0.3);
  padding: 0 0.15rem;
  border-radius: 0.2rem;
}

.viewport-warning {
  display: none;
}

@media (max-width: 768px) {
  .viewport-warning {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-6);
    text-align: center;
    background: var(--color-bg);
    color: var(--color-text);
  }

  .viewport-warning-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-4);
    color: var(--color-text-secondary);
  }

  .viewport-warning h2 {
    font-size: var(--text-xl);
    margin: 0 0 var(--space-3);
  }

  .viewport-warning p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin: 0;
    max-width: 320px;
    line-height: 1.5;
  }

  .container {
    display: none !important;
  }
}
