trailer-session-selector {
  display: block;
  min-width: 0;
  min-height: 0;
}

trailer-session-selector > .sidebar {
  width: 100%;
  height: 100%;
}

html[data-theme="light"] .sidebar {
  background:
    linear-gradient(
      180deg,
      rgba(20, 121, 201, 0.06),
      transparent 180px
    ),
    var(--panel);
}

html[data-theme="light"] .filter-box input {
  background: #f6f9fc;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(
      180deg,
      rgba(86, 180, 255, 0.05),
      transparent 180px
    ),
    var(--panel);
}

.sidebar-header {
  flex: 0 0 auto;
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.brand {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(86, 180, 255, 0.4);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.filter-box {
  position: relative;
}

.filter-box input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #0d141d;
  color: var(--text);
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.filter-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-box input::placeholder {
  color: #66758a;
}

.clear-filter {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.clear-filter:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.sidebar-content {
  display: grid;
  grid-template-rows:
    minmax(220px, 3fr)
    minmax(190px, 2fr);
  flex: 1 1 auto;
  min-height: 0;
}

.trailer-pane,
.session-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.session-pane {
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.055);
}

html[data-theme="light"] .session-pane {
  background: rgba(20, 121, 201, 0.025);
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.025em;
}

.trailer-pane-header {
  gap: 8px;
}

.trailer-pane-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.trailer-scope-switch {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .trailer-scope-switch {
  background: rgba(20, 121, 201, 0.04);
}

.trailer-scope-switch button {
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.trailer-scope-switch button:hover:not(:disabled) {
  color: var(--text);
}

.trailer-scope-switch button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.trailer-scope-switch button:disabled {
  cursor: default;
  opacity: 0.55;
}

.trailer-count {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.trailer-list,
.session-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: #3b4c60 transparent;
  scrollbar-width: thin;
}

.trailer-item,
.session-item {
  margin: 2px 0;
}

.trailer-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 100ms ease,
    border-color 100ms ease,
    transform 100ms ease;
}

.trailer-button:hover,
.session-button:hover {
  background: var(--panel-hover);
}

.trailer-button:active,
.session-button:active {
  transform: translateY(1px);
}

.trailer-button.active,
.session-button.active {
  border-color: rgba(86, 180, 255, 0.38);
  background: var(--accent-soft);
}

.trailer-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.trailer-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trailer-arrived {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trailer-id {
  align-self: start;
  padding-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.session-button {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 100ms ease,
    border-color 100ms ease,
    transform 100ms ease;
}

.session-button.open:not(.active) {
  border-color: rgba(101, 212, 154, 0.18);
}

.session-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.session-primary {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-id {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.session-secondary {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-error {
  flex: 0 0 auto;
  margin: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 125, 125, 0.3);
  border-radius: 8px;
  background: rgba(67, 24, 29, 0.5);
  color: #ffd4d4;
  font-size: 11px;
  line-height: 1.4;
}

html[data-theme="light"] .session-error {
  background: rgba(255, 235, 237, 0.97);
  color: #8e2630;
}

.session-empty-note {
  flex: 0 0 auto;
  padding: 0 14px 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.sidebar-state {
  padding: 24px 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.sidebar-state.compact {
  padding: 18px 14px;
  font-size: 12px;
}

.sidebar-state.error {
  color: var(--danger);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: 1px;
}

.status-dot.ready {
  background: var(--success);
  box-shadow:
    0 0 10px
    rgba(101, 212, 154, 0.6);
}

@media (max-width: 780px) {
  trailer-session-selector {
    min-height: 430px;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-content {
    grid-template-rows:
      minmax(220px, 1fr)
      auto;
  }

  .trailer-pane-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .trailer-pane-tools {
    justify-content: space-between;
    width: 100%;
  }

  .session-pane {
    max-height: 176px;
  }

  .session-list {
    display: flex;
    gap: 8px;
    padding: 8px 10px 10px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .session-item {
    flex: 0 0 auto;
    margin: 0;
  }

  .session-button {
    width: 210px;
    min-height: 68px;
  }
}
