/* =============================================================================
   Alian ERP — global styles
   ============================================================================= */

/* Design tokens */
:root {
  /* Brand palette — refined navy-blue (electronics / industrial feel) */
  --brand: #1e40af;
  --brand-hover: #1e3a8a;
  --brand-light: #dbeafe;
  --brand-text: #1e40af;

  /* Semantic colors (more muted than Bootstrap defaults) */
  --success: #047857;
  --success-light: #d1fae5;
  --warning: #b45309;
  --warning-light: #fef3c7;
  --danger: #b91c1c;
  --danger-light: #fee2e2;
  --info: #0e7490;
  --info-light: #cffafe;

  /* Surface + text */
  --bg: #f1f5f9;
  --bg-subtle: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;

  /* Shadows — soft, layered */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.05), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px rgba(15, 23, 42, 0.06), 0 4px 6px rgba(15, 23, 42, 0.04);

  /* Radii */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Spacing rhythm */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;

  /* Transitions */
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================================================
   Base
   ============================================================================= */
html, body {
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5 {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1, .h1 { font-size: 1.625rem; }
h2, .h2 { font-size: 1.375rem; }
h3, .h3 { font-size: 1.25rem; }
h4, .h4 { font-size: 1.125rem; }
h5, .h5 { font-size: 1rem; }

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}

code {
  background: var(--bg);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
  font-family: 'SF Mono', 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;
}

.text-muted { color: var(--text-muted) !important; }

/* =============================================================================
   App shell — vertical sidebar layout
   .app-shell holds the sidebar (rendered by nav.ejs as offcanvas-lg) and the
   main content area side-by-side at lg+. On smaller screens the sidebar
   collapses into a Bootstrap offcanvas and a topbar is used for the trigger.
   ============================================================================= */
.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.app-content {
  flex: 1 1 auto;
  min-width: 0; /* prevents flex children from forcing horizontal scroll */
  display: flex;
  flex-direction: column;
}

/* Main container inside .app-content — keep the comfortable max-width */
main.container {
  max-width: 1280px;
  width: 100%;
  flex: 1 0 auto;
  padding-top: var(--space-5);
  padding-bottom: var(--space-8);
  min-height: 70vh;
}

/* ---------------------------------------------------------------------------
   Sidebar — dark slate background, vertical stack
   --------------------------------------------------------------------------- */
.app-sidebar {
  /* width applies both in flex layout (lg+) and inside offcanvas (mobile) */
  --bs-offcanvas-width: 260px;
  width: 260px;
  background-color: #ffffff;
  color: var(--brand);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}

/* At lg+ the sidebar is a sticky column in the flex layout. Bootstrap's
   offcanvas-lg already handles "behave as block above lg, offcanvas below".
   We just add stickiness so it stays in view while content scrolls. */
@media (min-width: 992px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden; /* nav scrolls inside; user block stays pinned */
    box-shadow: var(--shadow-xs);
  }
}

/* Brand row */
.app-sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand);
}
.app-sidebar__brand a {
  color: var(--brand);
  font-weight: 700;
}
.app-sidebar__brand a:hover {
  text-decoration: none;
  color: var(--brand-hover);
}
.app-sidebar__brand .bi {
  color: var(--brand);
}

/* Nav stack */
.app-sidebar__nav {
  flex: 1 1 auto;
  padding: 0.75rem 0.5rem 1rem 0.5rem;
  overflow-y: auto;
}

/* Section labels (Master Data / Operations / Analytics) */
.app-sidebar__group-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-subtle); /* slate-400 — quiet but readable on white */
  padding: 1rem 0.75rem 0.35rem 0.75rem;
}

/* Nav link — brand blue when inactive, light-blue tint on hover,
   solid brand pill with white text on active. */
.app-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--brand);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background-color var(--transition), color var(--transition);
  position: relative;
}
.app-sidebar__link:hover {
  background-color: var(--brand-light);
  color: var(--brand-hover);
  text-decoration: none;
}
.app-sidebar__link.active {
  background-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(30, 64, 175, 0.3);
}
.app-sidebar__link i.bi {
  font-size: 1.05rem;
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
  color: var(--brand);
  transition: color var(--transition);
}
.app-sidebar__link:hover i.bi {
  color: var(--brand-hover);
}
.app-sidebar__link.active i.bi {
  color: #ffffff;
}

/* User card at sidebar bottom — explicit black block w/ white text
   for clear separation from the light sidebar above. */
.app-sidebar__user {
  border-top: 1px solid #000000;
  padding: 0.65rem;
  background-color: #000000;
  color: #ffffff;
  flex-shrink: 0;
}
.app-sidebar__user-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  background: transparent;
  border: 0;
  color: #ffffff;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background-color var(--transition);
}
.app-sidebar__user-btn:hover,
.app-sidebar__user-btn:focus {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  outline: none;
}
.app-sidebar__user-btn > i.bi {
  color: #ffffff;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.app-sidebar__user-btn::after {
  /* push Bootstrap's dropdown caret to the far right */
  margin-left: auto;
  color: rgba(255, 255, 255, 0.7);
}
.app-sidebar__user-info {
  flex: 1 1 auto;
  min-width: 0;
}
.app-sidebar__user-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
  line-height: 1.2;
}
.app-sidebar__user-email {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7); /* slightly muted but clearly readable */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* Sidebar's dropdown menu uses the same polished light surface as the rest */
.app-sidebar .dropdown-menu {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  padding: var(--space-2);
}
.app-sidebar .dropdown-item {
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
}

/* ---------------------------------------------------------------------------
   Mobile top bar — shown only <lg, hidden once sidebar is visible.
   Matches the sidebar's light theme for visual consistency.
   --------------------------------------------------------------------------- */
.app-topbar {
  background-color: #ffffff;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border);
}
.app-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--brand);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}
.app-topbar__brand .bi {
  color: var(--brand);
}
.app-topbar__brand:hover {
  color: var(--brand-hover);
  text-decoration: none;
}
.app-topbar .dropdown-menu {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  padding: var(--space-2);
}
.app-topbar .dropdown-item {
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
}

/* =============================================================================
   Cards
   ============================================================================= */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  background-color: var(--surface);
  transition: box-shadow var(--transition);
}
.card-header {
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  font-size: 0.925rem;
}
.card-body {
  padding: 1.25rem;
}
.card-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Subtle hover lift on clickable cards (links/anchors only) */
a > .card,
.card.card-clickable {
  cursor: pointer;
}
a > .card:hover,
.card.card-clickable:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Colored card borders (for dashboard / status emphasis) */
.card.border-success  { border-left: 3px solid var(--success); }
.card.border-warning  { border-left: 3px solid var(--warning); }
.card.border-danger   { border-left: 3px solid var(--danger); }
.card.border-info     { border-left: 3px solid var(--info); }
.card.border-primary  { border-left: 3px solid var(--brand); }

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
  font-weight: 500;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid transparent;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.btn:focus,
.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.2);
  outline: none;
}
.btn-sm {
  font-size: 0.8125rem;
  padding: 0.3rem 0.65rem;
  border-radius: 5px;
}
.btn-primary {
  background-color: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--brand-hover);
  border-color: var(--brand-hover);
}
.btn-outline-primary {
  color: var(--brand);
  border-color: var(--brand);
}
.btn-outline-primary:hover {
  background-color: var(--brand);
  color: #fff;
}
.btn-outline-secondary {
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.btn-outline-secondary:hover {
  background-color: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
}

/* =============================================================================
   Tables
   ============================================================================= */
.table {
  color: var(--text);
  margin-bottom: 0;
}
.table thead th {
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  vertical-align: middle;
}
.table tbody td {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:first-child td {
  border-top: none;
}
.table-hover tbody tr {
  transition: background-color var(--transition);
}
.table-hover tbody tr:hover {
  background-color: var(--bg-subtle);
}
.table tfoot td {
  border-top: 2px solid var(--border-strong);
  padding: 0.75rem 1rem;
  background: var(--bg-subtle);
}
.table-secondary {
  --bs-table-bg: #f1f5f9;
  --bs-table-color: var(--text-subtle);
}
.table-warning {
  --bs-table-bg: var(--warning-light);
}

/* =============================================================================
   Forms
   ============================================================================= */
.form-label {
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.form-control,
.form-select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  background-color: var(--surface);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}
.form-control-sm,
.form-select-sm {
  font-size: 0.85rem;
  padding: 0.375rem 0.6rem;
}
.form-text {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: 0.3rem;
}

/* =============================================================================
   Badges
   ============================================================================= */
.badge {
  font-weight: 500;
  font-size: 0.7rem;
  padding: 0.3em 0.6em;
  letter-spacing: 0.02em;
  border-radius: 5px;
}
.bg-success { background-color: var(--success) !important; }
.bg-warning { background-color: var(--warning) !important; }
.bg-danger  { background-color: var(--danger) !important; }
.bg-info    { background-color: var(--info) !important; }
.bg-primary { background-color: var(--brand) !important; }

/* Match Bootstrap utility classes to our brand palette so home.ejs cards,
   buttons, badges all sit in the same color family. */
.text-primary { color: var(--brand) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }
.text-info    { color: var(--info) !important; }

/* =============================================================================
   Page header pattern
   ============================================================================= */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.page-header__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.page-header__title .bi {
  color: var(--text-subtle);
  font-size: 1.25rem;
}
.page-header__subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}
.page-header__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Toolbar (search + filters + add) */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.toolbar .search-box {
  flex: 1;
  min-width: 220px;
  max-width: 420px;
  position: relative;
}
.toolbar .search-box .bi-search {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}
.toolbar .search-box input {
  padding-left: 2.25rem;
}

/* Inline From / To date range — sits in the toolbar next to the search box */
.toolbar-daterange {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.toolbar-daterange input[type="date"] {
  width: auto;
  min-width: 130px;
}
.toolbar-daterange label {
  white-space: nowrap;
}

/* =============================================================================
   Empty states
   ============================================================================= */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
}
.empty-state__icon {
  font-size: 2.5rem;
  color: var(--text-subtle);
  margin-bottom: var(--space-3);
  display: block;
}
.empty-state__title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.empty-state__hint {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* =============================================================================
   Stat cards (dashboard / summary metrics)
   ============================================================================= */
.stat-card {
  padding: var(--space-4) var(--space-5);
}
.stat-card__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.3rem;
}
.stat-card__detail {
  font-size: 0.825rem;
  color: var(--text-muted);
}

/* =============================================================================
   Dashboard KPI tiles — large headline metrics on the home page
   Color variants tint the left border + the icon, so each metric reads its
   "tone" at a glance: blue for inventory, info for production, green for
   dispatches, amber for low-stock alerts (gray when nothing's wrong).
   ============================================================================= */
.kpi-card {
  border-left: 4px solid var(--border);
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}
a > .kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.kpi-card__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.kpi-card__label .bi {
  font-size: 1rem;
}
.kpi-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}
.kpi-card__detail {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Color variants */
.kpi-card--primary { border-left-color: var(--brand); }
.kpi-card--primary .kpi-card__label .bi { color: var(--brand); }

.kpi-card--info { border-left-color: var(--info); }
.kpi-card--info .kpi-card__label .bi { color: var(--info); }

.kpi-card--success { border-left-color: var(--success); }
.kpi-card--success .kpi-card__label .bi { color: var(--success); }

.kpi-card--warning { border-left-color: var(--warning); }
.kpi-card--warning .kpi-card__label .bi { color: var(--warning); }
.kpi-card--warning .kpi-card__value { color: var(--warning); }

.kpi-card--muted { border-left-color: var(--success); }
.kpi-card--muted .kpi-card__label .bi { color: var(--success); }

/* =============================================================================
   Pulse cards — smaller "today's activity" tiles
   ============================================================================= */
.pulse-card {
  border: 1px solid var(--border);
}
.pulse-card .card-body {
  padding: 1rem 1.1rem;
}
.pulse-card__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.pulse-card__label .bi {
  font-size: 1rem;
}
.pulse-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.3rem;
}
.pulse-card__detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* =============================================================================
   Alerts
   ============================================================================= */
.alert {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}
.alert-success { background: var(--success-light); border-color: rgba(4, 120, 87, 0.2); color: #064e3b; }
.alert-warning { background: var(--warning-light); border-color: rgba(180, 83, 9, 0.2);  color: #78350f; }
.alert-danger  { background: var(--danger-light);  border-color: rgba(185, 28, 28, 0.2); color: #7f1d1d; }
.alert-info    { background: var(--info-light);    border-color: rgba(14, 116, 144, 0.2); color: #164e63; }

/* =============================================================================
   Pagination footer (used by partials/_pagination.ejs)
   ============================================================================= */
.pagination-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: var(--space-4);
  padding: var(--space-3) 0;
}
.pagination-footer__range {
  flex: 0 0 auto;
}
.pagination-nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.pagination-nav .btn-sm {
  min-width: 2rem;
  padding: 0.3rem 0.55rem;
  justify-content: center;
}
.pagination-nav .btn-sm.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.pagination-gap {
  color: var(--text-subtle);
  font-size: 0.875rem;
  padding: 0 0.25rem;
}
.pagination-footer__perpage {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pagination-footer__perpage select {
  width: auto;
  min-width: 70px;
}

/* =============================================================================
   Breadcrumb
   ============================================================================= */
.breadcrumb {
  margin-bottom: var(--space-3);
  font-size: 0.85rem;
}
.breadcrumb-item + .breadcrumb-item::before {
  color: var(--text-subtle);
}
.breadcrumb-item.active {
  color: var(--text-muted);
}

/* =============================================================================
   Footer
   ============================================================================= */
footer.container {
  border-top: 1px solid var(--border);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  font-size: 0.8125rem;
}

/* =============================================================================
   Utility tweaks
   ============================================================================= */
hr { border-color: var(--border); opacity: 1; }

.form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}
.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
  border-color: var(--brand);
}

/* =============================================================================
   Tom Select dropdown overrides
   =============================================================================
   Paired with `dropdownParent: 'body'` in public/js/app.js. With that option,
   the dropdown popup is a direct <body> child rather than nested inside the
   select's wrapper, so it escapes any overflow:hidden / overflow:auto on
   parent containers (the common offender is Bootstrap's .table-responsive
   around the BOM editor / dispatch / receipt / consumption / WO line tables).
   These rules tune the popup itself.
   ============================================================================= */

/* The option list. Default bootstrap5 theme caps this at 200px which feels
   cramped on long lists of components. 360px gives a comfortable ~10 rows
   before the user has to scroll — and scrolling DOES work because overflow-y
   is auto. */
.ts-dropdown .ts-dropdown-content {
  max-height: 360px;
  overflow-y: auto;
}

/* Stack above the sidebar (≤1030 in Bootstrap), modal backdrop (1050) and
   modal itself (1055). 1080 leaves headroom for tooltips/popovers. With
   dropdownParent: 'body' the popup is at the document root so this z-index
   is what governs paint order against everything else. */
.ts-dropdown {
  z-index: 1080;
}
