/* Table-style dropdown for js/combo-picker.js */
.cp-panel {
  position: fixed;
  z-index: 2000;
  overflow-y: auto;
  overflow-x: hidden;
  /* The browser's default light scrollbar stands out against the dark panel. */
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.cp-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.85rem;
}

.cp-table th {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.cp-table td {
  padding: 10px 14px;
  color: var(--text-primary);
  vertical-align: top;
}

/* Every column shrinks to its content; the grow column takes what is left and wraps,
   so nothing is cut off and the panel never scrolls sideways. */
.cp-fit {
  width: 1%;
  white-space: nowrap;
}
.cp-grow {
  white-space: normal;
  overflow-wrap: anywhere;
}
/* Breaks at spaces only (combo-picker.js wraps each chunk in .cp-nobreak): the column then
   shrinks to its longest chunk - a whole ERP order number - and a long free-text MES number
   goes onto a second line instead of widening the column for every row. */
.cp-wrap { white-space: normal; }
.cp-nobreak { white-space: nowrap; }

.cp-row { cursor: pointer; }
.cp-row:hover td { background: rgba(0, 210, 255, 0.06); }
.cp-row.is-active td { background: var(--accent-blue-glow); }

.cp-mono {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 0.8rem;
  color: var(--text-secondary) !important;
}

.cp-muted { color: var(--text-secondary) !important; }

.cp-strong { font-weight: 700; }

.cp-badge-erp { color: var(--accent-blue) !important; font-weight: 700; }

.cp-status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--text-muted);
}
.cp-status--running::before { background: var(--status-running); }
.cp-status--stopped::before { background: var(--status-stopped); }

.cp-empty {
  padding: 14px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: center;
}

/* Phone: no room for columns, so each row becomes a two-line card - the short fields on
   the first line (the first one pushes the rest to the right), the grow column below. */
@media (max-width: 600px) {
  .cp-narrow-hide { display: none !important; }
  .cp-table thead { display: none; }
  .cp-table, .cp-table tbody { display: block; }
  .cp-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
  }
  .cp-row:last-child { border-bottom: none; }
  .cp-table td { display: block; padding: 0; width: auto; }
  .cp-row td:first-child { flex: 1 1 auto; min-width: 0; }
  .cp-row .cp-grow { order: 1; flex: 1 1 100%; color: var(--text-secondary); font-size: 0.8rem; }
  .cp-row .cp-grow:empty { display: none; }
  .cp-row:hover, .cp-row.is-active { background: var(--accent-blue-glow); }
  .cp-row:hover td, .cp-row.is-active td { background: transparent; }
}
