.header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--header-border);
  flex-shrink: 0;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  box-shadow: var(--header-shadow);
}

.topRow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.menuBtn {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted);
  border: 1px solid var(--toolbar-border);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

.menuBtn:hover {
  background: #fff;
  color: var(--text-primary);
}

.titleBlock {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.title {
  margin: 0;
  min-width: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topActions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.bottomRow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--toolbar-border);
  border-radius: 12px;
  background: var(--toolbar-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fieldLabel {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  line-height: 1;
  padding-left: 2px;
}

.selectWrap {
  position: relative;
  min-width: 0;
}

.selectWrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 8px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-tertiary);
  transform: translateY(-35%);
  pointer-events: none;
}

.select {
  appearance: none;
  height: 30px;
  min-width: 120px;
  max-width: 220px;
  width: 100%;
  padding: 0 24px 0 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 9px;
  background: #fff;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.selectModel {
  min-width: 140px;
  max-width: min(280px, 34vw);
  font-family: var(--font-mono, ui-monospace, monospace);
}

.selectCompact {
  min-width: 68px;
  max-width: 88px;
}

.select:focus {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.select:disabled {
  color: var(--text-tertiary);
  background: rgba(248, 250, 252, 0.9);
  cursor: not-allowed;
}

.statsWrap {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.statsWrap::before {
  content: "";
  width: 1px;
  align-self: stretch;
  min-height: 24px;
  margin-right: 2px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(15, 23, 42, 0.08) 18%,
    rgba(15, 23, 42, 0.08) 82%,
    transparent 100%
  );
  flex-shrink: 0;
}

.toolsToggleBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--surface-muted);
  border: 1px solid var(--toolbar-border);
  border-radius: 9px;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

.toolsToggleBtn:hover {
  background: #fff;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .header {
    gap: 6px;
    padding: 8px 10px 7px;
  }

  .menuBtn {
    display: flex;
  }

  .title {
    font-size: 14px;
  }

  .bottomRow {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 6px;
  }

  .controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 6px;
    width: 100%;
  }

  .fieldLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .select {
    height: 32px;
    min-width: 0;
    max-width: none;
    font-size: 12px;
  }

  .selectModel,
  .selectCompact {
    min-width: 0;
    max-width: none;
  }

  .statsWrap::before {
    display: none;
  }
}

@media (max-width: 420px) {
  .title {
    font-size: 13px;
  }
}
